fix(installed-summary): drop compgen (absent in wrapped bash)

Booting the VM showed "line 31: compgen: command not found" from
nomarchy-installed-summary on first boot. compgen is a bash
programmable-completion builtin, and the non-interactive bash the script
gets wrapped with (via makeWrapper + patchShebangs) is compiled without
progcomp. Beyond the visible error, the battery-presence check silently
failed to the else branch, so a laptop was always reported as "desktop".
Replace `compgen -G` with a nullglob array (a shopt, always available).
The installer's identical check runs under the ISO's interactive bash, so
it was unaffected — this script is the only compgen user.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-05-30 21:30:35 +01:00
parent 14c22cbbaa
commit 8e5e63facb

View File

@@ -26,9 +26,14 @@ tz=$(jq_or_empty "$SYS_STATE" '.timezone')
dns=$(jq_or_empty "$SYS_STATE" '.dns')
hybrid_gpu=$(jq_or_empty "$SYS_STATE" '.features.hybridGPU')
# Form factor: same battery-presence check the installer uses to auto-set
# nomarchy.{system.,}formFactor.
if compgen -G "/sys/class/power_supply/BAT*" >/dev/null; then
# Form factor: battery presence (same signal the installer uses to auto-set
# nomarchy.{system.,}formFactor). `compgen` is a bash programmable-completion
# builtin, and the non-interactive bash this script gets wrapped with is
# compiled without it — so a glob into a nullglob array, not `compgen -G`.
shopt -s nullglob
batteries=( /sys/class/power_supply/BAT* )
shopt -u nullglob
if (( ${#batteries[@]} )); then
form_factor="laptop"
else
form_factor="desktop"