Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 26 Feb 2019 21:25:39 +0100
Subject: [PATCH] grub-switch-to-blscfg: copy increment.mod for legacy BIOS and
 ppc64

This module is also used in newer GRUB config and weren't present in old
GRUB installations, so it has to be copied before attempting to generate
a BLS configuration.

Resolves: rhbz#1652806

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
 util/grub-switch-to-blscfg.in | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
index eeea1307706..49b3985fadb 100644
--- a/util/grub-switch-to-blscfg.in
+++ b/util/grub-switch-to-blscfg.in
@@ -288,13 +288,15 @@ if [ "${GENERATE}" -eq 1 ] ; then
     copy_bls
 
     if [ $arch = "x86_64" ] && [ ! -d /sys/firmware/efi ]; then
-	if ! cp ${prefix}/lib/grub//i386-pc/blscfg.mod ${grubdir}/i386-pc/ ; then
-	    exit 1
-	fi
+	mod_dir="i386-pc"
     elif [ $arch = "ppc64" -o $arch = "ppc64le" ] && [ ! -d /sys/firmware/opal ]; then
-	if ! cp ${prefix}/lib/grub/powerpc-ieee1275/blscfg.mod ${grubdir}/powerpc-ieee1275/ ; then
-	    exit 1
-	fi
+	mod_dir="powerpc-ieee1275"
+    fi
+
+    if [ -n "${mod_dir}" ]; then
+	for mod in blscfg increment; do
+	    cp ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1
+	done
     fi
 
     cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}"