diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-21 20:12:55 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-21 20:12:55 -0500 |
| commit | ebda614a8dd43b44f8e0d9d844eac7a979a011bd (patch) | |
| tree | e6a6695cec04d19dfcad882ef2dc9afe36bf6da2 | |
| parent | 4c5af5c5bf2112c301efc3e4da1cf8812051692a (diff) | |
| download | archangel-ebda614a8dd43b44f8e0d9d844eac7a979a011bd.tar.gz archangel-ebda614a8dd43b44f8e0d9d844eac7a979a011bd.zip | |
fix: cleanup on empty findmnt + stale profiledef entries
Two pre-existing build.sh bugs surfaced while rebuilding the ISO for
the first time since the April lib/ refactor.
1. safe_cleanup_work_dir runs findmnt | grep | sort in a command
substitution. When no mounts match (the common case — this is a
defensive sweep on top of the explicit known-mount loop), grep
exits 1, pipefail propagates it, set -e exits the script. The
trap then reports "Build interrupted or failed" and the build
aborts before doing any work. Swallow the grep status with
|| true; no-match is not an error here.
2. The profiledef.sh file_permissions seds drifted out of sync with
the lib/ refactor:
- lib/zfs.sh was removed in 3321f0f but its sed block stayed,
producing a warning every build ("Cannot change permissions of
'.../lib/zfs.sh': no such file").
- lib/raid.sh was added in 19f4624 without a corresponding sed,
so the file shipped with whatever permissions cp gave it.
Drop the zfs.sh block and add the raid.sh block.
| -rwxr-xr-x | build.sh | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -50,9 +50,11 @@ safe_cleanup_work_dir() { # Catch any other mounts under airootfs (bind mounts not in the # explicit list above). Deepest-first via reverse sort. + # grep exits 1 on no-match; with pipefail that would propagate and + # trip set -e, so swallow it — "no leftover mounts" is the common case. local leftover leftover=$(findmnt --list --noheadings -o TARGET 2>/dev/null \ - | grep "$airootfs" | sort -r) + | grep "$airootfs" | sort -r || true) if [[ -n "$leftover" ]]; then while IFS= read -r mp; do umount -l "$mp" 2>/dev/null || true @@ -422,10 +424,10 @@ if grep -q "file_permissions=" "$PROFILE_DIR/profiledef.sh"; then /)/ i\ ["/usr/local/bin/lib/disk.sh"]="0:0:755" }' "$PROFILE_DIR/profiledef.sh" sed -i '/^file_permissions=(/,/)/ { - /)/ i\ ["/usr/local/bin/lib/zfs.sh"]="0:0:755" + /)/ i\ ["/usr/local/bin/lib/btrfs.sh"]="0:0:755" }' "$PROFILE_DIR/profiledef.sh" sed -i '/^file_permissions=(/,/)/ { - /)/ i\ ["/usr/local/bin/lib/btrfs.sh"]="0:0:755" + /)/ i\ ["/usr/local/bin/lib/raid.sh"]="0:0:755" }' "$PROFILE_DIR/profiledef.sh" sed -i '/^file_permissions=(/,/)/ { /)/ i\ ["/etc/shadow"]="0:0:400" |
