summaryrefslogtreecommitdiff
path: root/src/boot/grub2/grub2-15_ostree
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javierm@redhat.com>2020-03-26 17:20:08 +0100
committerJavier Martinez Canillas <javierm@redhat.com>2020-04-06 20:44:19 +0200
commit768eee87f667397a5f714eeed071a6ebe9686d46 (patch)
tree005efa872d69a0ec9017bade8cefc1540c5fa8af /src/boot/grub2/grub2-15_ostree
parenta16fe86b3695a997bab7814d9de63f7e09f07e93 (diff)
downloadostree-768eee87f667397a5f714eeed071a6ebe9686d46.tar.gz
grub2: Don't add menu entries if GRUB supports parsing BLS snippets
This is another attempt to avoid having duplicated menu entries caused by GRUB having support to parse BLS snippets and the 15_ostree script adding menu entries as well. The previous attempt was in commit 985a1410029 ("grub2: Exit gracefully if the configuration has BLS enabled") but that lead to users not having menu entries at all, due having an old GRUB version that was not able to parse the BLS snippets. This happened because the GRUB bootloader is never updated in the ESP as a part of the OSTree upgrade transaction. The logic is similar to the previous commit, the 15_ostree script exits if able to determine that the bootloader can parse the BLS snippets directly. But this time it will not only check that a BLS configuration was enabled, but also that a /boot/grub2/.grub2-blscfg-supported file exists. This file has to be created by a component outside of OSTree that also takes care of updating GRUB to a version that has proper BLS support.
Diffstat (limited to 'src/boot/grub2/grub2-15_ostree')
-rw-r--r--src/boot/grub2/grub2-15_ostree10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/boot/grub2/grub2-15_ostree b/src/boot/grub2/grub2-15_ostree
index 0b9bf930..9042708e 100644
--- a/src/boot/grub2/grub2-15_ostree
+++ b/src/boot/grub2/grub2-15_ostree
@@ -26,6 +26,16 @@ if ! test -d /ostree/repo; then
exit 0
fi
+# Gracefully exit if the grub2 configuration has BLS enabled,
+# and the installed version has support for the blscfg module.
+# Since there is no need to create menu entries for that case.
+# See: https://src.fedoraproject.org/rpms/grub2/c/7c2bab5e98d
+. /etc/default/grub
+if test -f /boot/grub2/.grub2-blscfg-supported && \
+ test "${GRUB_ENABLE_BLSCFG}" = "true"; then
+ exit 0
+fi
+
# Make sure we're in the right environment
if ! test -n "${GRUB_DEVICE}"; then
echo "This script must be run as a child of grub2-mkconfig" 1>&2