@@ -32,6 +32,7 @@ color() {
3232 BOLD=$(echo "\033[1m")
3333 HOLD=" "
3434 TAB=" "
35+ TAB3=" "
3536
3637 # Icons
3738 CM="${TAB}✔️${TAB}"
@@ -528,29 +529,29 @@ advanced_settings() {
528529 exit_script
529530 fi
530531
531-
532532 BRIDGES=""
533533 IFACE_FILEPATH_LIST="/etc/network/interfaces"$'\n'$(find "/etc/network/interfaces.d/" -type f)
534- OLD_IFS=$IFS; IFS=$'\n'
534+ OLD_IFS=$IFS
535+ IFS=$'\n'
535536
536537 for iface_filepath in ${IFACE_FILEPATH_LIST}; do
537538 iface_indexes_tmpfile=$(mktemp -q -u '.iface-XXXX')
538539
539- ( grep -Pn '^\s*iface' "${iface_filepath}" | cut -d':' -f1 && wc -l "${iface_filepath}" | cut -d' ' -f1 ) | \
540- awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' > "${iface_indexes_tmpfile}"
540+ (grep -Pn '^\s*iface' "${iface_filepath}" | cut -d':' -f1 && wc -l "${iface_filepath}" | cut -d' ' -f1) |
541+ awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' >"${iface_indexes_tmpfile}"
541542
542543 if [ -f "${iface_indexes_tmpfile}" ]; then
543- while read -r pair; do
544- start=$(echo "${pair}" | cut -d':' -f1)
545- end=$(echo "${pair}" | cut -d':' -f2)
544+ while read -r pair; do
545+ start=$(echo "${pair}" | cut -d':' -f1)
546+ end=$(echo "${pair}" | cut -d':' -f2)
546547
547- if awk "NR >= ${start} && NR <= ${end}" "${iface_filepath}" | grep -qP '^\s*bridge[-_](ports|stp|fd|vlan-aware|vids)\s+'; then
548- iface_name=$(sed "${start}q;d" "${iface_filepath}" | awk '{print $2}')
549- BRIDGES="${iface_name}"$'\n'"${BRIDGES}"
550- fi
548+ if awk "NR >= ${start} && NR <= ${end}" "${iface_filepath}" | grep -qP '^\s*bridge[-_](ports|stp|fd|vlan-aware|vids)\s+'; then
549+ iface_name=$(sed "${start}q;d" "${iface_filepath}" | awk '{print $2}')
550+ BRIDGES="${iface_name}"$'\n'"${BRIDGES}"
551+ fi
551552
552- done < "${iface_indexes_tmpfile}"
553- rm -f "${iface_indexes_tmpfile}"
553+ done <"${iface_indexes_tmpfile}"
554+ rm -f "${iface_indexes_tmpfile}"
554555 fi
555556
556557 done
@@ -564,11 +565,11 @@ advanced_settings() {
564565 echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
565566 else
566567 BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --menu "Select network bridge:" 15 40 6 $(echo "$BRIDGES" | awk '{print $0, "Bridge"}') 3>&1 1>&2 2>&3)
567- if [ -z "$BRG" ]; then
568- exit_script
569- else
570- echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
571- fi
568+ if [ -z "$BRG" ]; then
569+ exit_script
570+ else
571+ echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
572+ fi
572573 fi
573574
574575 while true; do
@@ -963,18 +964,17 @@ config_file() {
963964 else
964965 msg_error "Invalid IP Address format for Gateway. Needs to be 0.0.0.0, was ${GATE}"
965966 exit
967+ fi
968+ else
969+ msg_error "Gateway IP Address cannot be empty"
970+ exit
966971 fi
967- else
968- msg_error "Gateway IP Address cannot be empty"
969- exit
970- fi
971972 else
972973 msg_error "Invalid IP Address format. Needs to be 0.0.0.0/0, was ${NET}"
973974 exit
974975 fi
975976 fi
976977
977-
978978 if [[ ! -z "$APT_CACHER_IP" ]]; then
979979 if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then
980980 APT_CACHER="yes"
0 commit comments