Fix "local: can only be used in a function" crash in the category menu

The dynamic checklist-sizing code added in the previous commit used
`local` for its variables, but the category menu loop it lives in is
top-level script code, not inside a function — `local` only works inside
one. Confirmed live: this broke the whiptail menu outright on first
`sudo ./setup.sh` run after pulling ("only be used in a function", then an
unbound-variable error under set -u since the assignment before it never
ran). Drop `local`; these are the same kind of plain loop-scoped variables
every other var in this loop (CHOSEN_CAT, SVCS, CHOICE, SELECTED) already
is.
This commit is contained in:
Claude
2026-08-10 14:53:44 +00:00
parent 3a3833596c
commit 3e75c51d18
+1 -2
View File
@@ -390,11 +390,10 @@ while true; do
# terminal can show (tput lines, falling back to a conservative 24
# for a non-terminal/unknown size) so this can't request a dialog
# taller than the screen.
local _term_lines _list_h _box_h
_term_lines="$(tput lines 2>/dev/null </dev/tty || echo 24)"
_list_h=${#SVCS[@]}
[ "$_list_h" -gt 20 ] && _list_h=20
local _term_cap=$((_term_lines - 10))
_term_cap=$((_term_lines - 10))
[ "$_term_cap" -lt 6 ] && _term_cap=6
[ "$_list_h" -gt "$_term_cap" ] && _list_h="$_term_cap"
_box_h=$((_list_h + 8))