From 15e3958687df66e47b927e05084d50005b1e6928 Mon Sep 17 00:00:00 2001 From: teohz <77596774+teohz@users.noreply.github.com> Date: Mon, 28 Jul 2025 13:11:52 +0000 Subject: [PATCH] fix: removing ",gw=" from GATE variable when reading/writing from/to config. (#6177) Previously when creating a config, GATE variable would incluse ",gw=" which was crashing the installer script when read later on. This fix: 1. writes GATE variable to config without ",gw=" 2. removes ",gw=" from GATE variable when reading existing config Co-authored-by: teohz --- misc/build.func | 1 + misc/config-file.func | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/build.func b/misc/build.func index 8a9bcbbc81..061ccaee86 100644 --- a/misc/build.func +++ b/misc/build.func @@ -249,6 +249,7 @@ write_config() { # This function writes the configuration to a file. if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "Write configfile" --yesno "Do you want to write the selections to a config file?" 10 60; then FILEPATH="/opt/community-scripts/${NSAPP}.conf" + [[ "$GATE" =~ ",gw=" ]] && local GATE="${GATE##,gw=}" if [[ ! -f $FILEPATH ]]; then cat <"$FILEPATH" # ${NSAPP} Configuration File diff --git a/misc/config-file.func b/misc/config-file.func index 842c1246c3..ed72aa2197 100644 --- a/misc/config-file.func +++ b/misc/config-file.func @@ -272,7 +272,8 @@ config_file() { GATE="" elif [[ "$NET" =~ $ip_cidr_regex ]]; then echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}" - if [ ! -z "$GATE" ]; then + if [[ -n "$GATE" ]]; then + [[ "$GATE" =~ ",gw=" ]] && GATE="${GATE##,gw=}" if [[ "$GATE" =~ $ip_regex ]]; then echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}$GATE${CL}" GATE=",gw=$GATE"