summaryrefslogtreecommitdiff
path: root/sys-boot/os-prober/files/os-prober-btrfs-absolute-subvol.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-01-28 00:37:32 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-01-28 00:37:32 +0000
commit3f81fd7097ec931ebf6d862622e6d81834483dbb (patch)
treee8381bb314f59122a26bd714f1a14993a31ab8ee /sys-boot/os-prober/files/os-prober-btrfs-absolute-subvol.patch
parent351bdb27fc041435144b39e022d9830c140ebd3a (diff)
sys-boot/os-prober : shamelessly take all the patches from openSUSE Factory to make it work
Diffstat (limited to 'sys-boot/os-prober/files/os-prober-btrfs-absolute-subvol.patch')
-rw-r--r--sys-boot/os-prober/files/os-prober-btrfs-absolute-subvol.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/sys-boot/os-prober/files/os-prober-btrfs-absolute-subvol.patch b/sys-boot/os-prober/files/os-prober-btrfs-absolute-subvol.patch
new file mode 100644
index 00000000..5b8ff050
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-btrfs-absolute-subvol.patch
@@ -0,0 +1,41 @@
+Index: os-prober/os-probes/common/50mounted-tests
+===================================================================
+--- os-prober.orig/os-probes/common/50mounted-tests
++++ os-prober/os-probes/common/50mounted-tests
+@@ -72,9 +72,7 @@ mounted=
+
+ if [ "$types" = btrfs ]; then
+ partition="$BTRFSDEV"
+-fi
+-
+-if type grub2-mount >/dev/null 2>&1 && \
++elif type grub2-mount >/dev/null 2>&1 && \
+ type grub2-probe >/dev/null 2>&1 && \
+ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
+ mounted=1
+@@ -110,7 +108,11 @@ if [ "$mounted" ]; then
+ fi
+ done
+ fi
+-do_unmount
++
++if [ "$types" != "btrfs" ]; then
++ do_unmount
++ exit 1
++fi
+
+ # all btrfs processing here. Handle both unmounted and
+ # mounted subvolumes.
+@@ -125,9 +127,9 @@ if [ "$types" = btrfs ]; then
+ exit 1
+ fi
+ # besides regular subvols, get ro and snapshot so thet can be excluded
+- subvols=$(btrfs subvolume list "$tmpmnt" | cut -d ' ' -f 9)
+- rosubvols=$(btrfs subvolume list -r "$tmpmnt" | cut -d ' ' -f 9)
+- sssubvols=$(btrfs subvolume list -s "$tmpmnt" | cut -d ' ' -f 14)
++ subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!)
++ rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!)
++ sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!)
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount btrfs volume on $tmpmnt"
+ rmdir "$tmpmnt" || true