dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0208-grub-switch-to-blscfg-Only-fix-boot-prefix-for-non-g.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Javier Martinez Canillas <javierm@redhat.com>
d9d99f
Date: Wed, 18 Jul 2018 08:07:37 +0200
d9d99f
Subject: [PATCH] grub-switch-to-blscfg: Only fix boot prefix for non-generated
d9d99f
 BLS files
d9d99f
d9d99f
The BLS files are either copied from /lib/modules/$kernelver/bls.conf or
d9d99f
generated if this file doesn't exist. The shipped bls.conf default path
d9d99f
for the kernel and initramfs is relative to the boot partition.
d9d99f
d9d99f
But in some setups /boot may not be a mount point so in that case the
d9d99f
boot prefix has to be added to the BLS. But we already provide this
d9d99f
prefix for generated BLS files so attempting to add a boot prefix will
d9d99f
lead to a path that contains the boot prefix twice (i.e: /boot/boot).
d9d99f
d9d99f
Reported-by: Hans de Goede <hdegoede@redhat.com>
d9d99f
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
d9d99f
---
d9d99f
 util/grub-switch-to-blscfg.in | 9 ++++-----
d9d99f
 1 file changed, 4 insertions(+), 5 deletions(-)
d9d99f
d9d99f
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
d9d99f
index 40612e00686..9cf64f8e725 100644
d9d99f
--- a/util/grub-switch-to-blscfg.in
d9d99f
+++ b/util/grub-switch-to-blscfg.in
d9d99f
@@ -236,6 +236,10 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
d9d99f
 
d9d99f
     if [ -f "${kernel_dir}/bls.conf" ] ; then
d9d99f
         cp -af "${kernel_dir}/bls.conf" "${bls_target}"
d9d99f
+        if [ -n "${bootprefix}" ]; then
d9d99f
+            sed -i -e "s,^\(linux[^ \t]*[ \t]\+\).*,\1${bootprefix}${linux},g" "${bls_target}"
d9d99f
+            sed -i -e "/^initrd/ s,\([ \t]\+\)\([^ \t]\+\),\1${bootprefix}\2,g" "${bls_target}"
d9d99f
+        fi
d9d99f
     else
d9d99f
         mkbls "${kernelver}" \
d9d99f
             "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" \
d9d99f
@@ -243,11 +247,6 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
d9d99f
             >"${bls_target}"
d9d99f
     fi
d9d99f
 
d9d99f
-    if [ -n "${bootprefix}" ]; then
d9d99f
-        sed -i -e "s,^\(linux[^ \t]*[ \t]\+\).*,\1${bootprefix}${linux},g" "${bls_target}"
d9d99f
-        sed -i -e "/^initrd/ s,\([ \t]\+\)\([^ \t]\+\),\1${bootprefix}\2,g" "${bls_target}"
d9d99f
-    fi
d9d99f
-
d9d99f
     if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then
d9d99f
         arch="$(uname -m)"
d9d99f
         bls_debug="$(echo ${bls_target} | sed -e "s/\.${arch}/-debug.${arch}/")"