summaryrefslogtreecommitdiff
path: root/setup-disk.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2023-01-24 11:33:01 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2023-01-24 10:41:58 +0000
commit4abe368206e79cfed88af3edfb15321439e0b763 (patch)
tree2a29cea44e737b45ffea0fdbb7a88785b6f31e94 /setup-disk.in
parentbe385e614eafdf5f95e35ad3cbd4eaa378b96752 (diff)
downloadalpine-conf-4abe368206e79cfed88af3edfb15321439e0b763.zip
setup-disk: fix detection of EFI directory
Try autodetect the EFI directory instead of hardcoding it to /boot/efi. This is needed when /boot is the EFI directory and no encryption is used.
Diffstat (limited to 'setup-disk.in')
-rw-r--r--setup-disk.in18
1 files changed, 14 insertions, 4 deletions
diff --git a/setup-disk.in b/setup-disk.in
index 6fb3075..1f70835 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -285,13 +285,25 @@ get_bootopt() {
done
}
+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
+ done
+ return 1
+}
+
# setup GRUB bootloader
setup_grub() {
local mnt="$1" root="$2" modules="$3" kernel_opts="$4" bootdev="$5"
# install GRUB efi mode
if [ -n "$USE_EFI" ]; then
local target fwa
- local efi_directory="$mnt"/boot/efi
+ local efi_directory=$(find_efi_directory "$mnt") || \
+ echo "WARNING: EFI directory was not found" >&2
case "$ARCH" in
x86_64) target=x86_64-efi ; fwa=x64 ;;
x86) target=i386-efi ; fwa=ia32 ;;
@@ -299,9 +311,7 @@ setup_grub() {
aarch64) target=arm64-efi ; fwa=aa64 ;;
riscv64) target=riscv64-efi ; fwa=riscv64 ;;
esac
- if [ -n "$USE_CRYPT" ]; then
- efi_directory="$mnt"/boot
- fi
+
# currently disabling nvram so grub doesnt call efibootmgr
# installing to alpine directory so other distros dont overwrite it
$MOCK grub-install --target=$target --efi-directory="$efi_directory" \