diff options
| author | Craig Jennings <c@cjennings.net> | 2026-09-13 10:59:31 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-09-13 10:59:31 -0500 |
| commit | 6e99a7fbae089009e7948cb3853b68364f2f527b (patch) | |
| tree | 4c4165815ba363824a98485e4a45f16a97e10ffc /custom | |
| parent | 3bab9f1ff287c61e85504ad5ab0c5a0d69bf0a61 (diff) | |
| download | archangel-6e99a7fbae089009e7948cb3853b68364f2f527b.tar.gz archangel-6e99a7fbae089009e7948cb3853b68364f2f527b.zip | |
fix(install): run the failure cleanup when an install step fails
Every install step runs inside a function, and bash never delivers an ERR trap to a command failing inside a called function. With `set -e` the installer exited without `install_failure_cleanup` ever running. That left /mnt mounted and the pool imported, so a re-run or the test harness's retry died at "Disk in use". The `|| error` shape had the same problem, because `error()` calls a plain `exit 1` that no ERR trap sees.
The failure trap now also fires on EXIT, and `arm_failure_trap` and `disarm_failure_trap` set and clear it in one place. I left errtrace off on purpose. It hands the trap to command substitutions, so a masked failing `$(...)` would run the cleanup in a subshell and unmount /mnt while the install carried on.
Once the cleanup runs, three more things could stop it from finishing. A SIGTERM to the whole process group also kills the logging tee, and the cleanup then died on SIGPIPE at its first message. It now ignores SIGPIPE and turns errexit off for itself with `local -`. It also ignores INT and TERM, so a second Ctrl-C can't cut it short. The pool export could race pacman's still-exiting chroot processes and fail as busy, so the export and the Btrfs LUKS close now retry for up to 15 seconds. The Btrfs branch also gets the recursive unmount with a lazy fallback that the ZFS branch already had.
Diffstat (limited to 'custom')
0 files changed, 0 insertions, 0 deletions
