wolf: fix unbound-variable crash on a single-drive box with no unmounted disks

Confirmed live on a laptop with only its internal drive (no second/
unmounted disk at all): the game-storage-directory picker's `local -a
_UNMT_DEV _UNMT_LABEL _UNMT_UUID` declares the arrays but, when the lsblk
scan finds zero qualifying unmounted block devices, never actually assigns
an element to any of them. Under setup.sh's `set -u`, that's enough for a
later read (`${#_UNMT_DEV[@]}`) to throw "unbound variable" even though
the arrays were properly `local -a` declared — a known bash nounset quirk
this repo has already hit and documented once before (see
vendor/ai-stack/configure-searxng-safesearch.sh). Explicit `=()`
initializers side-step it. The sibling `_CAND_*` arrays a few lines above
don't need the same fix — they always get at least one element (the home
directory option is unconditional), so they can't hit this path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VLX1yYKJExGSXmgUhxKQG6
This commit is contained in:
Claude
2026-09-01 23:41:15 +00:00
parent 7ed376e9b7
commit c9d1eac7f2
+7 -2
View File
@@ -647,8 +647,13 @@ UDEV
((_ci++))
done < <(lsblk -Pno NAME,MOUNTPOINT,SIZE,LABEL,UUID 2>/dev/null)
# Unmounted block devices — skip disks that have any mounted partition
local -a _UNMT_DEV _UNMT_LABEL _UNMT_UUID
# Unmounted block devices — skip disks that have any mounted partition.
# Explicit =() initializers, not bare `local -a` — under setup.sh's
# `set -u`, an array that never gets an element assigned (e.g. a laptop
# with no second/unmounted drive at all) can still trip "unbound
# variable" on later reads like ${#_UNMT_DEV[@]} below, even though it
# was declared with `local -a`. Confirmed live on a single-drive laptop.
local -a _UNMT_DEV=() _UNMT_LABEL=() _UNMT_UUID=()
local _ui=0
while IFS= read -r _line; do
local _name _size _type _fstype _mnt _label