Prevent %posttrans scriptlet to fail if grubenv isn't present in the ESP

Also simplify the logic to determine the filesystem UUID of the partition
that contains the /boot/grub2 directory.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2021-03-25 22:59:26 +01:00
parent 3face04f00
commit f2763e56df
No known key found for this signature in database
GPG key ID: C751E590D63F3D69

View file

@ -14,7 +14,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.06~rc1 Version: 2.06~rc1
Release: 2%{?dist} Release: 3%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/grub/ URL: http://www.gnu.org/software/grub/
@ -362,8 +362,7 @@ if grep -q "configfile" ${EFI_HOME}/grub.cfg; then
fi fi
# create a stub grub2 config in EFI # create a stub grub2 config in EFI
BOOT_DEVICE=$(df -P /boot | awk 'END{print $1}') BOOT_UUID=$(grub2-probe --target=fs_uuid ${GRUB_HOME})
BOOT_UUID=$(blkid -s UUID -o value "${BOOT_DEVICE}")
GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME}) GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME})
cat << EOF > ${EFI_HOME}/grub.cfg.stb cat << EOF > ${EFI_HOME}/grub.cfg.stb
@ -373,8 +372,10 @@ export \$prefix
configfile \$prefix/grub.cfg configfile \$prefix/grub.cfg
EOF EOF
cp -a ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave if test -f ${EFI_HOME}/grubenv; then
mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv cp -a ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave
mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv
fi
cp -a ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave cp -a ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave
cp -a ${EFI_HOME}/grub.cfg ${GRUB_HOME}/ cp -a ${EFI_HOME}/grub.cfg ${GRUB_HOME}/
@ -554,7 +555,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
%endif %endif
%changelog %changelog
* Wed Mar 24 2021 Javier Martinez Canillas <javierm@redhat.com> 2.06~rc1-2 * Thu Mar 25 2021 Javier Martinez Canillas <javierm@redhat.com> - 2.06~rc1-3
- Prevent %%posttrans scriptlet to fail if grubenv isn't present in the ESP
* Wed Mar 24 2021 Javier Martinez Canillas <javierm@redhat.com> - 2.06~rc1-2
- Fix a couple of merge mistakes made when rebasing to 2.06~rc1 - Fix a couple of merge mistakes made when rebasing to 2.06~rc1
Resolves: rhbz#1940524 Resolves: rhbz#1940524