From 9b3a34a754a12cfa73921bf2a4f8aea32cdb5fba Mon Sep 17 00:00:00 2001 From: Mateusz Sylwestrzak <401237-mattz7@users.noreply.gitlab.com> Date: Sat, 24 Feb 2024 01:53:23 +0100 Subject: [PATCH] refind: account for btrfs setups when generating manual stanzas --- srcpkgs/refind/files/kernel.post-install | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install index fd18f9c45ffe07..3b416721222f3e 100755 --- a/srcpkgs/refind/files/kernel.post-install +++ b/srcpkgs/refind/files/kernel.post-install @@ -22,12 +22,27 @@ tmpfile=$(mktemp /tmp/refind.XXXXXXX) zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g') +# establish ESP mounting point +efipath=$(echo $REFIND_CONF | sed 's/\/EFI.*$//') +if [ $efipath = "/boot" ]; then # mounting ESP to /boot with vmlinuz- and intramfs- stored on the EFI partition + efiprefix="" +else + efiprefix="\/$(dirname $efipath)" # mounting ESP to /boot/efi or another path +fi +rootfslabel=$(blkid -s LABEL -o value $(df -P / | awk 'NR==2 {print $1}')) + +# account for the BTRFS setups including subvolumes +if df -T / | awk 'NR==2 && $2 == "btrfs" {print "Root filesystem is Btrfs"}'; then + rootfssubvol=$(btrfs subvolume show / | head -n1) + echo "Btrfs subvol for ROOT is: $rootfssubvol" +fi + zentry=$(cat <