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
This commit is contained in:
Eduardo 2021-06-30 11:38:27 +02:00 committed by Javier Martinez Canillas
parent 419340f25e
commit fbeda573a9
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69

View File

@ -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}")"