@@ -528,7 +528,37 @@ advanced_settings() {
528528 exit_script
529529 fi
530530
531- BRIDGES=$( ip link show | grep -oP '(?<=: )vmbr\d+' | sort)
531+
532+ BRIDGES=""
533+ IFACE_FILEPATH_LIST="/etc/network/interfaces"$'\n'$(find "/etc/network/interfaces.d/" -type f)
534+ OLD_IFS=$IFS; IFS=$'\n'
535+
536+ for iface_filepath in ${IFACE_FILEPATH_LIST}; do
537+ iface_indexes_tmpfile=$(mktemp -q -u '.iface-XXXX')
538+
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}"
541+
542+ 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)
546+
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
551+
552+ done < "${iface_indexes_tmpfile}"
553+ rm -f "${iface_indexes_tmpfile}"
554+ fi
555+
556+ done
557+
558+ IFS=$OLD_IFS
559+
560+ BRIDGES=$(echo "$BRIDGES" | grep -v '^\s*$' | sort | uniq)
561+
532562 if [[ -z "$BRIDGES" ]]; then
533563 BRG="vmbr0"
534564 echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
@@ -1368,7 +1398,7 @@ description() {
13681398 <img src='https://img.shields.io/badge/☕-Buy us a coffee-blue' alt='spend Coffee' />
13691399 </a>
13701400 </p>
1371-
1401+
13721402 <span style='margin: 0 10px;'>
13731403 <i class="fa fa-github fa-fw" style="color: #f5f5f5;"></i>
13741404 <a href='https://github.com/community-scripts/ProxmoxVE' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>GitHub</a>
0 commit comments