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
parent c65a33ebca
commit 931f4f0364

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