Call grub2-mkconfig with --update-bls-cmdline

Recent versions of redhat grub2-mkconfig no longer automatically update
kernel arguments in BLS entries[1]. This change optionally adds the
--update-bls-cmdline argument where supported so this previous
behaviour continues to work.

[1] https://pkgs.devel.redhat.com/cgit/rpms/grub2/tree/0327-grub-mkconfig-dont-overwrite-BLS-cmdline-if-BLSCFG.patch?h=rhel-9.3.0

Change-Id: I568c34ef9b00b3a4e28ae13e013018fd6cedafa2
This commit is contained in:
Steve Baker 2024-03-05 07:07:34 +13:00
parent 0168c3057d
commit c9f3b1b231
1 changed files with 5 additions and 0 deletions

View File

@ -57,6 +57,11 @@ if [[ ! $($GRUBNAME --version) =~ ' 2.' ]]; then
exit 1
fi
# Ensure BLS entries are updated with default args
if [[ $($GRUB_MKCONFIG --help) =~ '--update-bls-cmdline' ]]; then
GRUB_MKCONFIG="$GRUB_MKCONFIG --update-bls-cmdline"
fi
# Some distros keep things in /boot/grub2, others in /boot/grub
if [ -d /boot/grub2 ]; then
GRUB_CFG=/boot/grub2/grub.cfg