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 <git@teohz.com>
This commit is contained in:
parent
7b82199a36
commit
15e3958687
@ -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 <<EOF >"$FILEPATH"
|
||||
# ${NSAPP} Configuration File
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user