2018-10-10 19:52:55 +02:00
|
|
|
Index: os-prober-1.76/os-probes/common/50mounted-tests
|
2013-12-23 13:07:20 +01:00
|
|
|
===================================================================
|
2018-10-10 19:52:55 +02:00
|
|
|
--- os-prober-1.76.orig/os-probes/common/50mounted-tests
|
|
|
|
+++ os-prober-1.76/os-probes/common/50mounted-tests
|
|
|
|
@@ -65,10 +65,40 @@ fi
|
2013-12-23 13:07:20 +01:00
|
|
|
|
|
|
|
mounted=
|
|
|
|
|
2017-02-20 12:06:06 +01:00
|
|
|
+if [ "$types" = btrfs ]; then
|
|
|
|
+ partition="$BTRFSDEV"
|
2013-12-23 13:07:20 +01:00
|
|
|
+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"
|
2017-02-20 12:06:06 +01:00
|
|
|
+ do_unmount
|
2013-12-23 13:07:20 +01:00
|
|
|
+ exit 0
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+fi
|
2017-02-20 12:06:06 +01:00
|
|
|
+do_unmount
|
2013-12-23 13:07:20 +01:00
|
|
|
+
|
2017-02-20 12:06:06 +01:00
|
|
|
# all btrfs processing here. Handle both unmounted and
|
|
|
|
# mounted subvolumes.
|
|
|
|
if [ "$types" = btrfs ]; then
|
|
|
|
- partition="$BTRFSDEV"
|
2013-12-23 13:07:20 +01:00
|
|
|
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
|
2018-10-10 19:52:55 +02:00
|
|
|
@@ -129,37 +159,8 @@ if [ "$types" = btrfs ]; then
|
2017-02-20 12:06:06 +01:00
|
|
|
rmdir "$tmpmnt" || true
|
2013-12-23 13:07:20 +01:00
|
|
|
if [ "$found" ]; then
|
|
|
|
exit 0
|
|
|
|
- else
|
|
|
|
- exit 1
|
2018-10-10 19:52:55 +02:00
|
|
|
- fi
|
|
|
|
-fi
|
|
|
|
-
|
2013-12-23 13:07:20 +01:00
|
|
|
-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
|
2018-10-10 19:52:55 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-12-23 13:07:20 +01:00
|
|
|
-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"
|
2017-02-20 12:06:06 +01:00
|
|
|
- do_unmount
|
2013-12-23 13:07:20 +01:00
|
|
|
- exit 0
|
|
|
|
- fi
|
|
|
|
- fi
|
|
|
|
- done
|
2017-02-20 12:06:06 +01:00
|
|
|
-fi
|
|
|
|
-do_unmount
|
|
|
|
-
|
|
|
|
# No tests found anything.
|
|
|
|
exit 1
|