From 3a4660f5a802ff7712da1c1003dbfabce4bd41df Mon Sep 17 00:00:00 2001 From: Alan Baghumian Date: Wed, 29 May 2024 15:33:22 -0700 Subject: [PATCH] AzureLinux UEFI fixes (#238) Updated setup-bootloader script to better handle different UEFI deployment scenarios. --- azurelinux/curtin/setup-bootloader | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/azurelinux/curtin/setup-bootloader b/azurelinux/curtin/setup-bootloader index e2e449a..48287d4 100755 --- a/azurelinux/curtin/setup-bootloader +++ b/azurelinux/curtin/setup-bootloader @@ -18,8 +18,13 @@ if [ -d /sys/firmware/efi/efivars/ ]; then yum install --assumeyes --quiet shim grub2-efi-binary - cat /boot/grub2/grub.cfg | grep search | sort -u | sed 's/^[ \t]*//' > /boot/efi/boot/grub2/grub.cfg - echo 'set prefix=($root)"/grub2"' >> /boot/efi/boot/grub2/grub.cfg + cat /boot/grub2/grub.cfg | grep search | sort -u | sed 's/^[ \t]*//' | head -n1 > /boot/efi/boot/grub2/grub.cfg + # Properly handle separate /boot partition scenarios + if [ $(cat /etc/fstab | grep -cw '/boot/') -gt 0 ]; then + echo 'set prefix=($root)"/grub2"' >> /boot/efi/boot/grub2/grub.cfg + else + echo 'set prefix=($root)"/boot/grub2"' >> /boot/efi/boot/grub2/grub.cfg + fi echo 'configfile $prefix/grub.cfg' >> /boot/efi/boot/grub2/grub.cfg else yum install --assumeyes --quiet grub2-pc