Don't attempt to unify if there is no grub.cfg on EFI

If there is no grub config, for example when installing the
system via anaconda, there is no need to attempt a grub
configuration unification. It will indeed actually break
because it will try to copy a non-existent file.

Resolves: rhbz#1933085
This commit is contained in:
Christian Kellner 2021-02-25 18:17:46 +01:00 committed by Javier Martinez Canillas
parent 0175fd5e80
commit 28c247bb67
No known key found for this signature in database
GPG key ID: C751E590D63F3D69

View file

@ -350,6 +350,10 @@ set -eu
EFI_HOME=/boot/efi/EFI/fedora
GRUB_HOME=/boot/grub2
if test ! -f ${EFI_HOME}/grub.cfg; then
exit 0 # nothing to unify, nothing to do
fi
if grep -q "configfile" ${EFI_HOME}/grub.cfg; then
exit 0 # already unified, nothing to do
fi
@ -366,11 +370,11 @@ export \$prefix
configfile \$prefix/grub.cfg
EOF
cp -av ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave
cp -a ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave
mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv
cp -av ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave
cp -av ${EFI_HOME}/grub.cfg ${GRUB_HOME}/
cp -a ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave
cp -a ${EFI_HOME}/grub.cfg ${GRUB_HOME}/
mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
%files common -f grub.lang