Changes to Config File Logic

This commit is contained in:
Michel Roegl-Brunner 2025-05-12 11:53:35 +02:00
parent 6ff773dc3d
commit 0bfa2b0af8

View File

@ -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