From fbeda573a9798fda3d18e67cef004df70e412789 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Wed, 30 Jun 2021 11:38:27 +0200 Subject: [PATCH] 20-grub-install: Use relative paths for btrfs in BLS snippets When SUSE_BTRFS_SNAPSHOT_BOOTING=true is set in /etc/default/grub, paths to kernel and initrd images need to be relative. Since are used along with snapper, configured so the default btrfs subvolume is the current snapshot. Resolves: rhbz#1906191 --- 20-grub.install | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/20-grub.install b/20-grub.install index 436360d..2a0ac32 100755 --- a/20-grub.install +++ b/20-grub.install @@ -112,7 +112,12 @@ case "$COMMAND" in LINUX="$(grep '^linux[ \t]' "${BLS_TARGET}" | sed -e 's,^linux[ \t]*,,')" INITRD="$(grep '^initrd[ \t]' "${BLS_TARGET}" | sed -e 's,^initrd[ \t]*,,')" - LINUX_RELPATH="$(grub2-mkrelpath /boot${LINUX})" + if [[ "$(grub2-probe --device $(grub2-probe --target=device /) --target=fs)" == "btrfs" && + "${SUSE_BTRFS_SNAPSHOT_BOOTING}" == "true" ]]; then + LINUX_RELPATH="$(grub2-mkrelpath -r /boot${LINUX})" + else + LINUX_RELPATH="$(grub2-mkrelpath /boot${LINUX})" + fi BOOTPREFIX="$(dirname ${LINUX_RELPATH})" ROOTPREFIX="$(dirname "/boot${LINUX}")"