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