Skip to content

Commit 6b54aa7

Browse files
martinezjavierd4s
authored andcommitted
grub2: Exit gracefully if the configuration has BLS enabled
Since Fedora 30 grub2 has support to populate its menu entries from the BootLoaderSpec fragments in /boot/loader/entries, so there's no need to generate menu entries anymore using the /etc/grub.d/15_ostree script. But since ostree doesn't update the bootloader, it may be that the grub2 installed is an old one that doesn't have BLS support. For new installs, GRUB_ENABLE_BLSCFG=true is set in /etc/default/grub to tell the /etc/grub.d/10_linux script if a blscfg command has to be added to the generated grub2 config file. So check if BLS is enabled in /etc/default/grub and only add the entries if that's not the case. Otherwise the menu entries will be duplicated. The approach has the drawback that if a user sets GRUB_ENABLE_BLSCFG=true in /etc/default/grub without updating grub2, they will get an empty menu. Since there won't be any entries created by the 30_ostree script and the blscfg command won't work on the older grub2. Unfortunately there is no way to know if the installed grub2 already has BLS support or not. Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751272#c27 Closes: ostreedev#1929 Approved by: jlebon
1 parent 91c838c commit 6b54aa7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/boot/grub2/grub2-15_ostree

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ if ! test -d /ostree/repo; then
2626
exit 0
2727
fi
2828

29+
# Gracefully exit if the grub2 configuration has BLS enabled,
30+
# since there is no need to create menu entries in that case.
31+
. /etc/default/grub
32+
if test ${GRUB_ENABLE_BLSCFG} = "true"; then
33+
exit 0
34+
fi
35+
2936
# Make sure we're in the right environment
3037
if ! test -n "${GRUB_DEVICE}"; then
3138
echo "This script must be run as a child of grub2-mkconfig" 1>&2

0 commit comments

Comments
 (0)