diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-27 13:20:30 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-27 13:20:30 -0500 |
| commit | 6dcdf180289823fceda376c67af9d4ea659463a8 (patch) | |
| tree | 28ddf17a13f70c7a05abe9a196888f3f66512a2a /tests/unit | |
| parent | 26f3f823ac17940a1b0153619f6140f45d856e33 (diff) | |
| download | archangel-6dcdf180289823fceda376c67af9d4ea659463a8.tar.gz archangel-6dcdf180289823fceda376c67af9d4ea659463a8.zip | |
refactor: extract MNTPOINT constant for the install chroot mount point
Last on the tech-debt drain. The installer hardcoded /mnt at 50+ sites: pacstrap, arch-chroot, mount/umount, fstab writes, and every host-side write into the chroot's /etc, /usr, /var, /boot, /tmp. Same magic-string smell as /mnt/efi but at much larger scale.
Add MNTPOINT="/mnt" to lib/common.sh next to EFI_DIR. Replace literal /mnt/... with $MNTPOINT/... across installer/archangel, installer/lib/btrfs.sh, and installer/lib/common.sh. Replace bare /mnt (mount target, arch-chroot root, umount target, install_dropin parameter) with $MNTPOINT. EFI_DIR's own definition becomes EFI_DIR="$MNTPOINT/efi" for the natural composition.
Folded in the related ticket: /mnt${chroot_efi_dir} in btrfs.sh:install_grub_all_efi becomes ${MNTPOINT}${chroot_efi_dir}. Was filed as a separate item but the ticket said it should ship with the MNTPOINT extraction, since the composition pattern is unusual and easy to miss in a global sed.
Three /mnt references kept literal in comments where the comment describes the string concept rather than the mount point ("Remove /mnt prefix - config is used inside chroot where root is /", etc.). Substituting to $MNTPOINT in those comments would obscure the documentation.
Bats: 146 → 147. One new test in test_common.bats pins MNTPOINT="/mnt". Lint clean (one shellcheck SC2295 warning fixed by quoting the parameter expansion: ${isp_firmware#"$MNTPOINT"}). VM verification deferred to a single full make test-install run after all three tech-debt commits land.
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_common.bats | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/unit/test_common.bats b/tests/unit/test_common.bats index 48efd15..abe3938 100644 --- a/tests/unit/test_common.bats +++ b/tests/unit/test_common.bats @@ -333,6 +333,10 @@ Boot0001* ZFSBootMenu" [ "$EFI_DIR" = "/mnt/efi" ] } +@test "MNTPOINT is defined and equals /mnt" { + [ "$MNTPOINT" = "/mnt" ] +} + ############################# # enable_sshd_root_login ############################# |
