From 173fb18386915b33bdcad69aa915143d4a89592a Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 15 Apr 2019 10:19:18 +0200 Subject: [PATCH] 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 --- grub2.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub2.spec b/grub2.spec index ce384ecb..e53b22ec 100644 --- a/grub2.spec +++ b/grub2.spec @@ -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