e3a408a
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
e3a408a
From: Javier Martinez Canillas <javierm@redhat.com>
e3a408a
Date: Tue, 12 Feb 2019 00:57:34 +0100
e3a408a
Subject: [PATCH] Set blsdir if the BLS directory path isn't one of the looked
e3a408a
 up by default
e3a408a
e3a408a
The blscfg command searches for BLS snippets in the /loader/entries and the
e3a408a
/boot/loader/entries directories. If the /boot/loader/entries dir real path
e3a408a
isn't one of these (i.e: if is in a btrfs subvolme), set the blsdir grubenv
e3a408a
variable so the blscfg command will be able to find the BLS config snippets.
e3a408a
e3a408a
Resolves: rhbz#1657240
e3a408a
e3a408a
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
e3a408a
---
e3a408a
 util/grub.d/10_linux.in     | 5 +++++
e3a408a
 util/grub.d/10_linux_bls.in | 5 +++++
e3a408a
 2 files changed, 10 insertions(+)
e3a408a
e3a408a
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
e3a408a
index 9c240f92625..7e80245a151 100644
e3a408a
--- a/util/grub.d/10_linux.in
e3a408a
+++ b/util/grub.d/10_linux.in
e3a408a
@@ -166,6 +166,11 @@ fi
e3a408a
 EOF
e3a408a
 
e3a408a
     if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
e3a408a
+        blsdir=$(make_system_path_relative_to_its_root "/boot/loader/entries")
e3a408a
+        if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then
e3a408a
+            ${grub_editenv} - set blsdir="${blsdir}"
e3a408a
+        fi
e3a408a
+
e3a408a
 	${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
e3a408a
 	if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
e3a408a
 	    ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"
e3a408a
diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in
e3a408a
index b14951daf82..f0ad9a3da25 100644
e3a408a
--- a/util/grub.d/10_linux_bls.in
e3a408a
+++ b/util/grub.d/10_linux_bls.in
e3a408a
@@ -226,6 +226,11 @@ linux_entry ()
e3a408a
     populate_menu
e3a408a
 
e3a408a
     if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
e3a408a
+        blsdir=$(make_system_path_relative_to_its_root "/boot/loader/entries")
e3a408a
+        if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then
e3a408a
+            ${grub_editenv} - set blsdir="${blsdir}"
e3a408a
+        fi
e3a408a
+
e3a408a
 	${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
e3a408a
 	if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
e3a408a
 	    ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"