From 0bfa2b0af86ba4b047b2e65f896918d033355c3f Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 12 May 2025 11:53:35 +0200 Subject: [PATCH] Changes to Config File Logic --- misc/build.func | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/misc/build.func b/misc/build.func index 2dad85d..d0ccb3e 100644 --- a/misc/build.func +++ b/misc/build.func @@ -823,27 +823,26 @@ config_file() { if [ "$NET" == "dhcp" ]; then echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}DHCP${CL}" echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}" - elif - [[ "$NET" =~ $ip_cidr_regex ]] - then + elif [[ "$NET" =~ $ip_cidr_regex ]]; then echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}" + if [ ! -z "$GATE" ]; then + if [[ "$GATE" =~ $ip_regex ]]; then + echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}$GATE${CL}" + GATE=",gw=$GATE" + else + msg_error "Invalid IP Address format for Gateway. Needs to be 0.0.0.0, was ${GATE}" + exit + fi + else + msg_error "Gateway IP Address cannot be empty" + exit + fi else msg_error "Invalid IP Address format. Needs to be 0.0.0.0/0, was ${NET}" exit fi fi - if [ ! -z "$GATE" ] && [ "$NET" != "dhcp" ]; then - if [[ "$GATE" =~ $ip_regex ]]; then - echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}$GATE${CL}" - GATE=",gw=$GATE" - else - msg_error "Invalid IP Address format for Gateway. Needs to be 0.0.0.0, was ${GATE}" - exit - fi - else - msg_error "Gateway IP Address cannot be empty" - exit - fi + if [[ ! -z "$APT_CACHER_IP" ]]; then if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then