diff --git a/AGENTS.md b/AGENTS.md index 392ec16..476330c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -44,6 +44,15 @@ don't fit a skill's step-by-step flow. its blocked stdin). A C++ module change needs an actual rebuild (out-of-tree, in the build VM) and redeploying the `.so` — no shortcut. +## Shell pitfalls + +`local a=/x b="$a/y"` expands every value before assigning any, so `b` is +`/y`: `calamares-online.sh` wrote the downloaded `steamify.sh` to +`/steamify.sh` and `items.json` to a nonexistent `/qml/`, silently (stderr +went to `/dev/null`), so the Steamify page always ran on build-time rows and +the Summary had no labels. Declare a variable in its own `local` before +using it, and send a step's errors to the launcher's log, not `/dev/null`. + ## ISO permissions `steamify-prepare.sh` fetches `steamify.sh` with `curl -o`, which doesn't diff --git a/archiso/airootfs/usr/local/bin/calamares-online.sh b/archiso/airootfs/usr/local/bin/calamares-online.sh index 5b4040c..9642374 100755 --- a/archiso/airootfs/usr/local/bin/calamares-online.sh +++ b/archiso/airootfs/usr/local/bin/calamares-online.sh @@ -47,7 +47,10 @@ EOF # Steamify: try the newest release before Calamares starts, so the page # and the install step both show/use it; keep the ISO's copy (from # steamify-prepare.sh) on any failure (no network, GitHub unreachable). - local sdir=/usr/local/share/steamify sbin="$sdir/steamify.sh" sqml="$sdir/qml" + # Separate statements: `local` expands all its values before assigning + # any, so "$sdir" would still be empty in the same one. + local sdir=/usr/local/share/steamify + local sbin="$sdir/steamify.sh" sqml="$sdir/qml" local tmp; tmp="$(mktemp)" if curl -fsSL --max-time 20 https://github.com/theupriser/steamify-cachyos/releases/latest/download/steamify.sh -o "$tmp" && grep -q -- '--defaults' "$tmp"; then @@ -68,7 +71,7 @@ EOF # punctuation and text fields Steamify itself writes: nothing here can # break out of the property). tmp="$(mktemp)" - if "$sbin" --defaults --list > "$tmp" 2>/dev/null && [[ -s "$tmp" ]]; then + if "$sbin" --defaults --list > "$tmp" 2>> "$log" && [[ -s "$tmp" ]]; then { printf 'pragma Singleton\nimport QtQuick\n\nQtObject {\n readonly property var rows: ' cat "$tmp" printf '\n}\n'