From 6dcdf180289823fceda376c67af9d4ea659463a8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 27 Apr 2026 13:20:30 -0500 Subject: refactor: extract MNTPOINT constant for the install chroot mount point MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- installer/lib/common.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'installer/lib/common.sh') diff --git a/installer/lib/common.sh b/installer/lib/common.sh index dfeb245..e5f7246 100644 --- a/installer/lib/common.sh +++ b/installer/lib/common.sh @@ -6,11 +6,19 @@ # Path Constants ############################# +# Mount point for the install chroot's root. Sub-paths compose with +# $MNTPOINT/etc/... (the host paths the installer writes into during +# pacstrap and config). Bare $MNTPOINT works since `/` isn't an +# identifier character; use ${MNTPOINT}${chroot_efi_dir} when the +# next character would otherwise be parsed as part of the variable +# name. +MNTPOINT="/mnt" + # Mount point for the primary EFI partition during install. Sub-paths # compose with ${EFI_DIR}/...; secondary EFI partitions in multi-disk # layouts use ${EFI_DIR}${i} (no trailing slash, so the index appends # cleanly). -EFI_DIR="/mnt/efi" +EFI_DIR="$MNTPOINT/efi" ############################# # Output Functions -- cgit v1.2.3