From bb44ca81f7d90479b2aba57f20e1b4cacf84df87 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 25 Jul 2026 20:24:46 -0500 Subject: [PATCH] update pulse installer --- defaults.inc | 2 +- inc/deploy-pulse-lxc.sh | 31 +++++++++++++++++++++---------- tests/test-pulse.sh | 11 +++++++++++ 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/defaults.inc b/defaults.inc index 48d55b3..a85c975 100755 --- a/defaults.inc +++ b/defaults.inc @@ -3,7 +3,7 @@ action="${1:-}" FOLDER='/opt/idssys/ta-proxmenu' -VERS='2026.7.25-48' +VERS='2026.7.25-49' noupdate=' ' diff --git a/inc/deploy-pulse-lxc.sh b/inc/deploy-pulse-lxc.sh index 995c132..029c5a3 100644 --- a/inc/deploy-pulse-lxc.sh +++ b/inc/deploy-pulse-lxc.sh @@ -152,18 +152,29 @@ TAPM_PULSE_FAIL() { return 1 } +TAPM_PULSE_SET_BRIDGE_FROM_SELECTION() { + local variable="$1" + local selection="${2:-}" + local selected_bridge + + [[ "$selection" == bridge:* ]] || return 1 + selected_bridge="${selection#bridge:}" + [[ -n "$selected_bridge" ]] || return 1 + printf -v "$variable" '%s' "$selected_bridge" +} + TAPM_PULSE_SELECT_BRIDGE() { local variable="$1" - local bridge default_bridge="${2:-vmbr0}" + local bridge_name default_bridge="${2:-vmbr0}" local default_found=0 local -a bridges=() local -a labels=() local -a values=() - while IFS= read -r bridge; do - [[ -n "$bridge" ]] || continue - bridges+=("$bridge") - [[ "$bridge" == "$default_bridge" ]] && default_found=1 + while IFS= read -r bridge_name; do + [[ -n "$bridge_name" ]] || continue + bridges+=("$bridge_name") + [[ "$bridge_name" == "$default_bridge" ]] && default_found=1 done < <( { for bridge_path in /sys/class/net/*/bridge; do @@ -182,15 +193,15 @@ TAPM_PULSE_SELECT_BRIDGE() { labels+=("${default_bridge} — default") values+=("bridge:${default_bridge}") fi - for bridge in "${bridges[@]}"; do - [[ $default_found == 1 && "$bridge" == "$default_bridge" ]] && continue - labels+=("$bridge") - values+=("bridge:${bridge}") + for bridge_name in "${bridges[@]}"; do + [[ $default_found == 1 && "$bridge_name" == "$default_bridge" ]] && continue + labels+=("$bridge_name") + values+=("bridge:${bridge_name}") done SELECT_MENU "Pulse network bridge" labels values case "$MENU_SELECTION" in - bridge:*) printf -v "$variable" '%s' "${MENU_SELECTION#bridge:}";; + bridge:*) TAPM_PULSE_SET_BRIDGE_FROM_SELECTION "$variable" "$MENU_SELECTION";; quit) EXIT1; exit 0;; *) return 1;; esac diff --git a/tests/test-pulse.sh b/tests/test-pulse.sh index cb61d80..3235392 100644 --- a/tests/test-pulse.sh +++ b/tests/test-pulse.sh @@ -15,6 +15,17 @@ assert_equal amd64 "$(TAPM_PULSE_ARCH x86_64)" "x86 architecture mapping" assert_equal arm64 "$(TAPM_PULSE_ARCH aarch64)" "ARM architecture mapping" assert_failure "unsupported Pulse architecture" TAPM_PULSE_ARCH riscv64 +test_bridge_selection_assignment() { + local bridge='' + + TAPM_PULSE_SET_BRIDGE_FROM_SELECTION bridge 'bridge:vmbr0' || return 1 + assert_equal vmbr0 "$bridge" "selected Pulse bridge assigned to caller" +} + +assert_success "Pulse bridge selection assignment" test_bridge_selection_assignment +assert_failure "empty Pulse bridge selection rejected" \ + TAPM_PULSE_SET_BRIDGE_FROM_SELECTION selected_bridge 'bridge:' + bootstrap_token='0123456789abcdef0123456789abcdef0123456789abcdef' bootstrap_output="║ Token: ${bootstrap_token} ║" assert_equal "$bootstrap_token" \