Merge "Move grubenv to EFI dir"
This commit is contained in:
commit
a4615a2977
@ -55,6 +55,16 @@ fi
|
|||||||
|
|
||||||
echo "Installing GRUB2..."
|
echo "Installing GRUB2..."
|
||||||
|
|
||||||
|
# This might be better factored out into a per-distro 'install-bootblock'
|
||||||
|
# helper.
|
||||||
|
if [ -d /boot/grub2 ]; then
|
||||||
|
GRUB_CFG=/boot/grub2/grub.cfg
|
||||||
|
GRUBENV=/boot/grub2/grubenv
|
||||||
|
elif [ -d /boot/grub ]; then
|
||||||
|
GRUB_CFG=/boot/grub/grub.cfg
|
||||||
|
GRUBENV=/boot/grub/grubenv
|
||||||
|
fi
|
||||||
|
|
||||||
# When using EFI image-based builds, particularly rhel element
|
# When using EFI image-based builds, particularly rhel element
|
||||||
# based on RHEL>=8.2 .qcow2, we might have /boot/grub2/grubenv
|
# based on RHEL>=8.2 .qcow2, we might have /boot/grub2/grubenv
|
||||||
# as a dangling symlink to /boot/efi because we have extracted
|
# as a dangling symlink to /boot/efi because we have extracted
|
||||||
@ -62,8 +72,8 @@ echo "Installing GRUB2..."
|
|||||||
# boot partition from the image. grub2-install calls rename()
|
# boot partition from the image. grub2-install calls rename()
|
||||||
# on this file, so if it's a dangling symlink it errors. Just
|
# on this file, so if it's a dangling symlink it errors. Just
|
||||||
# remove it if it exists.
|
# remove it if it exists.
|
||||||
if [[ -L /boot/grub2/grubenv ]]; then
|
if [[ -L $GRUBENV ]]; then
|
||||||
rm -f /boot/grub2/grubenv
|
rm -f $GRUBENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We need --force so grub does not fail due to being installed on the
|
# We need --force so grub does not fail due to being installed on the
|
||||||
@ -145,14 +155,6 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This might be better factored out into a per-distro 'install-bootblock'
|
|
||||||
# helper.
|
|
||||||
if [ -d /boot/grub2 ]; then
|
|
||||||
GRUB_CFG=/boot/grub2/grub.cfg
|
|
||||||
elif [ -d /boot/grub ]; then
|
|
||||||
GRUB_CFG=/boot/grub/grub.cfg
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Override the root device to the default label, and disable uuid
|
# Override the root device to the default label, and disable uuid
|
||||||
# lookup.
|
# lookup.
|
||||||
echo "GRUB_DEVICE=LABEL=${DIB_ROOT_LABEL}" >> /etc/default/grub
|
echo "GRUB_DEVICE=LABEL=${DIB_ROOT_LABEL}" >> /etc/default/grub
|
||||||
@ -238,12 +240,15 @@ fi
|
|||||||
if [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then
|
if [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then
|
||||||
sed -i 's%\(linux\|initrd\)16 /boot%\1efi /boot%g' $GRUB_CFG
|
sed -i 's%\(linux\|initrd\)16 /boot%\1efi /boot%g' $GRUB_CFG
|
||||||
|
|
||||||
# Finally copy the grub.cfg to the EFI specific dir to support
|
# Finally copy the grub.cfg and grubenv to the EFI specific dir
|
||||||
# functionality like secure boot. We make a copy because
|
# to support functionality like secure boot. We make a copy because
|
||||||
# /boot and /boot/efi may be different partitions and uefi looks
|
# /boot and /boot/efi may be different partitions and uefi looks
|
||||||
# for a specific partition UUID preventing symlinks from working.
|
# for a specific partition UUID preventing symlinks from working.
|
||||||
if [ -d /boot/efi/$EFI_BOOT_DIR ] ; then
|
if [ -d /boot/efi/$EFI_BOOT_DIR ] ; then
|
||||||
cp $GRUB_CFG /boot/efi/$EFI_BOOT_DIR/grub.cfg
|
cp $GRUB_CFG /boot/efi/$EFI_BOOT_DIR/grub.cfg
|
||||||
|
if [ -a $GRUBENV ]; then
|
||||||
|
cp $GRUBENV /boot/efi/$EFI_BOOT_DIR/grubenv
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user