diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 3b451d02..3e243325 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -156,6 +156,29 @@ if [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then fi fi +# Ensure paths in BLS entries account for /boot being a partition or part of the +# root partition +if [[ -e /boot/loader/entries ]]; then + pushd /boot/loader/entries + set +e + mountpoint /boot + bootmount=$? + + for entry in *; do + if [[ $bootmount -eq 0 ]]; then + sed -i "s| /boot/vmlinuz| /vmlinuz|" $entry + sed -i "s| /boot/initramfs| /initramfs|" $entry + else + sed -i "s| /vmlinuz| /boot/vmlinuz|" $entry + sed -i "s| /initramfs| /boot/initramfs|" $entry + fi + done + set -e + popd + # Print resulting grubby output for debug purposes + grubby --info=ALL +fi + if [[ ! "$ARCH" =~ "ppc" ]] && [[ -z "${DIB_BLOCK_DEVICE}" ]]; then echo "WARNING: No bootloader installation will occur." echo "To install a bootloader ensure you have included a block-device-* element" diff --git a/diskimage_builder/elements/rhel/post-install.d/03-reset-bls-entries b/diskimage_builder/elements/rhel/post-install.d/03-reset-bls-entries index d2bd4f6d..d4d5df5f 100755 --- a/diskimage_builder/elements/rhel/post-install.d/03-reset-bls-entries +++ b/diskimage_builder/elements/rhel/post-install.d/03-reset-bls-entries @@ -27,11 +27,6 @@ for entry in *.conf; do if [[ $entry != $new_entry ]]; then mv $entry $new_entry fi - - # RHEL-9 is unique in having a separate /boot partition, fix the paths to assume - # /boot will be in the root partition. - sed -i "s| /vmlinuz| /boot/vmlinuz|" $new_entry - sed -i "s| /initramfs| /boot/initramfs|" $new_entry done popd