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