388b8a4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
388b8a4
From: Javier Martinez Canillas <javierm@redhat.com>
388b8a4
Date: Tue, 26 Feb 2019 21:25:39 +0100
388b8a4
Subject: [PATCH] grub-switch-to-blscfg: copy increment.mod for legacy BIOS and
388b8a4
 ppc64
388b8a4
388b8a4
This module is also used in newer GRUB config and weren't present in old
388b8a4
GRUB installations, so it has to be copied before attempting to generate
388b8a4
a BLS configuration.
388b8a4
388b8a4
Resolves: rhbz#1652806
388b8a4
388b8a4
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
388b8a4
---
388b8a4
 util/grub-switch-to-blscfg.in | 14 ++++++++------
388b8a4
 1 file changed, 8 insertions(+), 6 deletions(-)
388b8a4
388b8a4
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
388b8a4
index eeea1307706..49b3985fadb 100644
388b8a4
--- a/util/grub-switch-to-blscfg.in
388b8a4
+++ b/util/grub-switch-to-blscfg.in
388b8a4
@@ -288,13 +288,15 @@ if [ "${GENERATE}" -eq 1 ] ; then
388b8a4
     copy_bls
388b8a4
 
388b8a4
     if [ $arch = "x86_64" ] && [ ! -d /sys/firmware/efi ]; then
388b8a4
-	if ! cp ${prefix}/lib/grub//i386-pc/blscfg.mod ${grubdir}/i386-pc/ ; then
388b8a4
-	    exit 1
388b8a4
-	fi
388b8a4
+	mod_dir="i386-pc"
388b8a4
     elif [ $arch = "ppc64" -o $arch = "ppc64le" ] && [ ! -d /sys/firmware/opal ]; then
388b8a4
-	if ! cp ${prefix}/lib/grub/powerpc-ieee1275/blscfg.mod ${grubdir}/powerpc-ieee1275/ ; then
388b8a4
-	    exit 1
388b8a4
-	fi
388b8a4
+	mod_dir="powerpc-ieee1275"
388b8a4
+    fi
388b8a4
+
388b8a4
+    if [ -n "${mod_dir}" ]; then
388b8a4
+	for mod in blscfg increment; do
388b8a4
+	    cp ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1
388b8a4
+	done
388b8a4
     fi
388b8a4
 
388b8a4
     cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}"