nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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