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:
@@ -26,9 +26,14 @@ tz=$(jq_or_empty "$SYS_STATE" '.timezone')
|
|||||||
dns=$(jq_or_empty "$SYS_STATE" '.dns')
|
dns=$(jq_or_empty "$SYS_STATE" '.dns')
|
||||||
hybrid_gpu=$(jq_or_empty "$SYS_STATE" '.features.hybridGPU')
|
hybrid_gpu=$(jq_or_empty "$SYS_STATE" '.features.hybridGPU')
|
||||||
|
|
||||||
# Form factor: same battery-presence check the installer uses to auto-set
|
# Form factor: battery presence (same signal the installer uses to auto-set
|
||||||
# nomarchy.{system.,}formFactor.
|
# nomarchy.{system.,}formFactor). `compgen` is a bash programmable-completion
|
||||||
if compgen -G "/sys/class/power_supply/BAT*" >/dev/null; then
|
# 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"
|
form_factor="laptop"
|
||||||
else
|
else
|
||||||
form_factor="desktop"
|
form_factor="desktop"
|
||||||
|
|||||||
Reference in New Issue
Block a user