diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-26 19:23:15 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-26 19:23:15 -0500 |
| commit | 9f62328988e83413eb819ac1ab2021a414188a67 (patch) | |
| tree | 9ea06850663aa4f941fd0de8982b9019c6d2f983 /installer/lib | |
| parent | f02ba03c12599bdd61b5208c9a65f458ae05aa15 (diff) | |
| download | archangel-9f62328988e83413eb819ac1ab2021a414188a67.tar.gz archangel-9f62328988e83413eb819ac1ab2021a414188a67.zip | |
refactor: extract EFI_DIR constant for the install-time EFI mount point
The literal /mnt/efi appeared at 17 sites across installer/archangel and installer/lib/btrfs.sh. Renaming it (or pointing tests at a different mount) meant touching every site and risking incomplete sweeps. One canonical name in installer/lib/common.sh now backs every reference.
EFI_DIR has no trailing slash so the three expansion patterns in the codebase compose cleanly. Bare ($EFI_DIR), sub-path ($EFI_DIR/EFI/ZBM), and the index-suffix used by install_grub_all_efi for secondary EFI mounts (${EFI_DIR}${i}). The sync_efi_partitions staging path also moves from the literal /mnt/efi_sync to ${EFI_DIR}_sync, so it follows EFI_DIR if anyone ever changes the base.
Two follow-ups filed as separate :techdebt: items. MNTPOINT=/mnt extraction across the 50+ /mnt/... sites (pacstrap, arch-chroot, fstab writes), and the related /mnt${chroot_efi_dir} composition pattern at btrfs.sh:681-682. Both ship together when MNTPOINT lands.
Verified: bats 134 → 135 (+1 pinning EFI_DIR=/mnt/efi). Lint clean. All four expansion patterns smoke-tested at runtime and produce the original literal byte-for-byte. VM run skipped, pure constant substitution with zero behavior change.
Diffstat (limited to 'installer/lib')
| -rw-r--r-- | installer/lib/btrfs.sh | 12 | ||||
| -rw-r--r-- | installer/lib/common.sh | 10 |
2 files changed, 16 insertions, 6 deletions
diff --git a/installer/lib/btrfs.sh b/installer/lib/btrfs.sh index f1cfaac..09127b2 100644 --- a/installer/lib/btrfs.sh +++ b/installer/lib/btrfs.sh @@ -567,8 +567,8 @@ configure_grub() { step "Configuring GRUB Bootloader" # Mount EFI partition - mkdir -p /mnt/efi - mount "$efi_partition" /mnt/efi + mkdir -p $EFI_DIR + mount "$efi_partition" $EFI_DIR # Configure GRUB defaults for btrfs info "Setting GRUB configuration..." @@ -624,7 +624,7 @@ EOF # Create grub directory on EFI partition # GRUB modules on FAT32 EFI partition avoid btrfs subvolume path issues - mkdir -p /mnt/efi/grub + mkdir -p $EFI_DIR/grub # Install GRUB with boot-directory on EFI partition info "Installing GRUB to EFI partition..." @@ -665,12 +665,12 @@ install_grub_all_efi() { for efi_part in "${efi_partitions[@]}"; do # First EFI at /efi (already mounted), subsequent at /efi2, /efi3, etc. local chroot_efi_dir="/efi" - local mount_point="/mnt/efi" + local mount_point="$EFI_DIR" local bootloader_id="GRUB" if [[ $i -gt 1 ]]; then chroot_efi_dir="/efi${i}" - mount_point="/mnt/efi${i}" + mount_point="$EFI_DIR${i}" bootloader_id="GRUB-disk${i}" # Mount secondary EFI partitions @@ -887,7 +887,7 @@ btrfs_cleanup() { sync # Unmount EFI first - umount /mnt/efi 2>/dev/null || true + umount $EFI_DIR 2>/dev/null || true # Unmount all btrfs subvolumes (reverse order) for ((i=${#BTRFS_SUBVOLS[@]}-1; i>=0; i--)); do diff --git a/installer/lib/common.sh b/installer/lib/common.sh index 98220fa..d375a9c 100644 --- a/installer/lib/common.sh +++ b/installer/lib/common.sh @@ -3,6 +3,16 @@ # Source this file: source "$(dirname "$0")/lib/common.sh" ############################# +# Path Constants +############################# + +# 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" + +############################# # Output Functions ############################# |
