From 50f79d861796a73d9b2c650553114c9a2778d9b4 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Apr 15 2019 15:49:07 +0000 Subject: Execute grub2-switch-to-blscfg script in %posttrans instead of %post The GRUB configuration is switched to BLS using the grub2-switch-to-blscfg script, which is installed by the grub2-tools package. Among other things, the script copies the blscfg module from the /usr/lib/grub/$arch directory to /boot/grub2/$arch. This is done because for non-UEFI installs (i386-pc and powerpc-ieee1275) the GRUB core and modules aren't updated on package upgrade, so the blscfg module won't be the latest that contains the current BLS support. But the grub2-switch-to-blscfg script is currently executed in grub2-tools %post scritplet, which means that if the grub2-tools package is installed before the grub2-pc-modules package (that installs the blscfg module), the grub2-switch-to-blscfg script won't copy the latest version of the module. This will make systems to fail to populate the GRUB menu, since its config will already be migrated to BLS but the blscfg module won't be the latest. So to make sure that the latest blscfg module is copied regardless of the grub2-tools and grub2-pc-modules packages install order, run the switch script in a grub2-tools %posttrans so it's executed at the end of the RPM transaction once all the packages have been installed. Resolves: rhbz#1652806 Signed-off-by: Javier Martinez Canillas --- diff --git a/grub2.spec b/grub2.spec index d3665e5..bd03c21 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 75%{?dist} +Release: 76%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -276,9 +276,9 @@ elif [ -f /etc/grub.d/01_users ] && \ fi fi -%post tools +%posttrans tools -if [ "$1" = 2 ]; then +if [ -f /etc/default/grub ]; then ! grep -q '^GRUB_ENABLE_BLSCFG=false' /etc/default/grub && \ /sbin/grub2-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || : fi @@ -476,6 +476,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Apr 15 2019 Javier Martinez Canillas - 2.02-76 +- Execute grub2-switch-to-blscfg script in %%posttrans instead of %%post + Resolves: rhbz#1652806 + * Thu Mar 28 2019 Javier Martinez Canillas - 2.02-75 - 10_linux_bls: don't add --users option to generated menu entries Resolves: rhbz#1693515