Complying with PR

This commit is contained in:
Wesley Reuel Marques Silva
2026-02-16 19:47:34 +00:00
committed by GitHub
parent ee1a0125ee
commit 0d7cf0f227
+23 -6
View File
@@ -398,6 +398,14 @@ parse_args() {
done
}
check_sudo() {
if ! command -v sudo &>/dev/null; then
log_error "sudo is required for iptables redirect but is not installed. Skipping iptables redirect."
return 1
fi
return 0
}
configure_iptables_redirect() {
if [[ "$OS_TYPE" != "linux" ]]; then
log_warn "iptables redirect only supported on Linux. Skipping."
@@ -408,6 +416,10 @@ configure_iptables_redirect() {
return
fi
if ! check_sudo; then
return
fi
log_info "Configuring iptables redirect: 990 -> 9990"
# Check if rule already exists
@@ -451,11 +463,16 @@ gather_config() {
fi
# Redirect port 990 -> 9990 (Linux only)
if [[ "$OS_TYPE" == "linux" ]] && [[ "$REDIRECT_990" != "true" ]]; then
echo ""
echo "Optional network configuration:"
if prompt_yes_no "Add iptables redirect (990 -> 9990)?" "n"; then
REDIRECT_990="true"
if [[ "$OS_TYPE" == "linux" ]]; then
if [[ "$NON_INTERACTIVE" == "true" ]]; then
# In non-interactive mode, only set REDIRECT_990 if explicitly passed
: # Do nothing, REDIRECT_990 is set only if --redirect-990 is passed
elif [[ "$REDIRECT_990" != "true" ]]; then
echo ""
echo "Optional network configuration:"
if prompt_yes_no "Add iptables redirect (990 -> 9990)?" "n"; then
REDIRECT_990="true"
fi
fi
fi
@@ -594,4 +611,4 @@ main() {
fi
}
main "$@"
main "$@"