summaryrefslogtreecommitdiff
path: root/sys-boot/os-prober/files/os-prober-fix-btrfs-subvol-mounted-tests.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-fix-btrfs-subvol-mounted-tests.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-fix-btrfs-subvol-mounted-tests.patch')
-rw-r--r--sys-boot/os-prober/files/os-prober-fix-btrfs-subvol-mounted-tests.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/sys-boot/os-prober/files/os-prober-fix-btrfs-subvol-mounted-tests.patch b/sys-boot/os-prober/files/os-prober-fix-btrfs-subvol-mounted-tests.patch
new file mode 100644
index 00000000..d56e0948
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-fix-btrfs-subvol-mounted-tests.patch
@@ -0,0 +1,84 @@
+Index: os-prober-1.76/os-probes/common/50mounted-tests
+===================================================================
+--- os-prober-1.76.orig/os-probes/common/50mounted-tests
++++ os-prober-1.76/os-probes/common/50mounted-tests
+@@ -65,10 +65,40 @@ fi
+
+ mounted=
+
++if [ "$types" = btrfs ]; then
++ partition="$BTRFSDEV"
++fi
++
++if type grub2-mount >/dev/null 2>&1 && \
++ type grub2-probe >/dev/null 2>&1 && \
++ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
++ mounted=1
++ type="$(grub2-probe -d "$partition" -t fs)" || true
++ if [ "$type" ]; then
++ debug "mounted using GRUB $type filesystem driver"
++ else
++ debug "mounted using GRUB, but unknown filesystem?"
++ type=fuseblk
++ fi
++fi
++
++if [ "$mounted" ]; then
++ for test in /usr/lib/os-probes/mounted/*; do
++ debug "running subtest $test"
++ if [ -f "$test" ] && [ -x "$test" ]; then
++ if "$test" "$partition" "$tmpmnt" "$type"; then
++ debug "os found by subtest $test"
++ do_unmount
++ exit 0
++ fi
++ fi
++ done
++fi
++do_unmount
++
+ # all btrfs processing here. Handle both unmounted and
+ # mounted subvolumes.
+ if [ "$types" = btrfs ]; then
+- partition="$BTRFSDEV"
+ debug "begin btrfs processing for $UUID"
+ # note that the btrfs volume must not be mounted ro
+ if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then
+@@ -129,37 +159,8 @@ if [ "$types" = btrfs ]; then
+ rmdir "$tmpmnt" || true
+ if [ "$found" ]; then
+ exit 0
+- else
+- exit 1
+- fi
+-fi
+-
+-if type grub2-mount >/dev/null 2>&1 && \
+- type grub2-probe >/dev/null 2>&1 && \
+- grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
+- mounted=1
+- type="$(grub2-probe -d "$partition" -t fs)" || true
+- if [ "$type" ]; then
+- debug "mounted using GRUB $type filesystem driver"
+- else
+- debug "mounted using GRUB, but unknown filesystem?"
+- type=fuseblk
+ fi
+ fi
+
+-if [ "$mounted" ]; then
+- for test in /usr/lib/os-probes/mounted/*; do
+- debug "running subtest $test"
+- if [ -f "$test" ] && [ -x "$test" ]; then
+- if "$test" "$partition" "$tmpmnt" "$type"; then
+- debug "os found by subtest $test"
+- do_unmount
+- exit 0
+- fi
+- fi
+- done
+-fi
+-do_unmount
+-
+ # No tests found anything.
+ exit 1