Add Description field for Bridges
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
This commit is contained in:
parent
ad967c9ae7
commit
8d00d2c9db
@ -220,6 +220,22 @@ get_current_ip() {
|
|||||||
echo "$CURRENT_IP"
|
echo "$CURRENT_IP"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# get_bridge_description()
|
||||||
|
#
|
||||||
|
# - Reads bridge descriptions from /usr/local/community-scripts/bridge_description
|
||||||
|
# - Returns description for given bridge name, or empty string if not found
|
||||||
|
# - File format: bridge_name:description (e.g., vmbr0:LAN, vmbr1:WAN)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
get_bridge_description() {
|
||||||
|
local bridge_name="$1"
|
||||||
|
local desc_file="/usr/local/community-scripts/bridge_description"
|
||||||
|
|
||||||
|
if [[ -f "$desc_file" ]]; then
|
||||||
|
grep "^${bridge_name}:" "$desc_file" 2>/dev/null | cut -d':' -f2- | head -n1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# update_motd_ip()
|
# update_motd_ip()
|
||||||
#
|
#
|
||||||
@ -613,7 +629,20 @@ advanced_settings() {
|
|||||||
BRG="vmbr0"
|
BRG="vmbr0"
|
||||||
echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
|
echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
|
||||||
else
|
else
|
||||||
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)
|
# Build bridge menu with descriptions
|
||||||
|
BRIDGE_MENU_OPTIONS=""
|
||||||
|
while IFS= read -r bridge; do
|
||||||
|
if [[ -n "$bridge" ]]; then
|
||||||
|
description=$(get_bridge_description "$bridge")
|
||||||
|
if [[ -n "$description" ]]; then
|
||||||
|
BRIDGE_MENU_OPTIONS="${BRIDGE_MENU_OPTIONS}${bridge} \"${bridge} - ${description}\" "
|
||||||
|
else
|
||||||
|
BRIDGE_MENU_OPTIONS="${BRIDGE_MENU_OPTIONS}${bridge} \"${bridge}\" "
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done <<< "$BRIDGES"
|
||||||
|
|
||||||
|
BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --menu "Select network bridge:" 15 60 6 $BRIDGE_MENU_OPTIONS 3>&1 1>&2 2>&3)
|
||||||
if [[ -z "$BRG" ]]; then
|
if [[ -z "$BRG" ]]; then
|
||||||
exit_script
|
exit_script
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user