From f37073e7b6144ee78dcb486e6ff19cd7e9db3a10 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 24 Mar 2023 14:32:58 +0100 Subject: setup-disk: find msdos and fat efi partitions fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10555 --- setup-disk.in | 10 ++++++---- tests/setup_disk_test | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/setup-disk.in b/setup-disk.in index 20be60c..f7eb689 100755 --- a/setup-disk.in +++ b/setup-disk.in @@ -297,10 +297,12 @@ get_bootopt() { find_efi_directory() { local mnt="$1" dir= for dir in boot/efi boot; do - if [ "$(find_mount_fs "$mnt"/$dir)" = vfat ]; then - echo "$mnt"/$dir - return - fi + case "$(find_mount_fs "$mnt"/$dir)" in + vfat|fat|msdos) + echo "$mnt"/$dir + return + ;; + esac done return 1 } diff --git a/tests/setup_disk_test b/tests/setup_disk_test index 028d28e..56ae715 100755 --- a/tests/setup_disk_test +++ b/tests/setup_disk_test @@ -12,6 +12,7 @@ init_tests \ setup_disk_func_uuid_or_device \ setup_disk_non_existing_block_dev \ setup_disk_install_mounted_root_nvme \ + setup_disk_install_mounted_root_efi \ setup_disk_install_mounted_root_efi_boot \ setup_disk_install_mounted_root_bootloader_none \ setup_disk_install_mounted_root_zfs @@ -265,6 +266,33 @@ setup_disk_install_mounted_root_nvme_body() { } +setup_disk_install_mounted_root_efi_body() { + init_env + for fs in vfat msdos fat; do + rm -rf target sys etc proc + mkdir -p target/boot/efi \ + sys/firmware/efi \ + + fake_mount "/dev/vda2 $PWD/target ext4 rw,noatime,data=ordered 0 0" + fake_mount "/dev/vda1 $PWD/target/boot/efi $fs rw,relatime,fmask=0022 0 0" + + atf_check -s exit:0 \ + -o match:"Installing system on /dev/vda2" \ + -o match:"grub-install .* --efi-directory=$PWD/target/boot/efi .* --boot-directory=$PWD/target/boot" \ + -o match:"install -D $PWD/target/boot/efi/EFI/alpine/grub.*efi $PWD/target/boot/efi/EFI/boot/bootaa64.efi" \ + setup-disk -v target + + atf_check \ + -o match:"/dev/vda2 / ext4 rw,noatime,data=ordered 0 1" \ + -o match:"/dev/vda1 /boot/efi $fs rw,relatime,fmask=0022 0 2" \ + cat target/etc/fstab + + atf_check -o match:"GRUB_CMDLINE_LINUX_DEFAULT=.*ext4" \ + cat target/etc/default/grub + done +} + +# test case when /boot is the efi vfat partition setup_disk_install_mounted_root_efi_boot_body() { init_env mkdir -p target/boot \ -- cgit v1.2.3