Fix BLS entries for /boot partitions
Creating a separate /boot partition is desirable in some cases[1]. This change detects if /boot is a partition, and ensures that the kernel/ramdisk paths are correct in either case. This is applied to all BLS entries files, whether they were generated by the previous grub2-mkconfig call or in the source image. This means the rhel9 specific workaround can be removed since all paths are now normalised at this stage. [1] https://review.opendev.org/c/openstack/tripleo-image-elements/+/846807 Change-Id: I62120ec8c65876e451532d2654d37435eb3606a6 Resolves: rhbz#2101514
This commit is contained in:
parent
0b72dbf293
commit
f118649738
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user