116 lines
2.9 KiB
Diff
116 lines
2.9 KiB
Diff
|
Index: os-prober-1.61/os-probes/common/50mounted-tests
|
||
|
===================================================================
|
||
|
--- os-prober-1.61.orig/os-probes/common/50mounted-tests
|
||
|
+++ os-prober-1.61/os-probes/common/50mounted-tests
|
||
|
@@ -56,10 +56,54 @@ fi
|
||
|
|
||
|
mounted=
|
||
|
|
||
|
-# all btrfs processing here. Handle both unmounted and
|
||
|
-# mounted subvolumes.
|
||
|
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
|
||
|
+else
|
||
|
+ ro_partition "$partition"
|
||
|
+ for type in $types; do
|
||
|
+ if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
|
||
|
+ debug "mounted as $type filesystem"
|
||
|
+ mounted=1
|
||
|
+ break
|
||
|
+ fi
|
||
|
+ done
|
||
|
+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"
|
||
|
+ if ! umount "$tmpmnt"; then
|
||
|
+ warn "failed to umount $tmpmnt"
|
||
|
+ fi
|
||
|
+ rmdir "$tmpmnt" || true
|
||
|
+ exit 0
|
||
|
+ fi
|
||
|
+ fi
|
||
|
+ done
|
||
|
+ if ! umount "$tmpmnt"; then
|
||
|
+ warn "failed to umount $tmpmnt"
|
||
|
+ fi
|
||
|
+fi
|
||
|
+
|
||
|
+# all btrfs subvol processing here. Handle both unmounted and
|
||
|
+# mounted subvolumes.
|
||
|
+if [ "$types" = btrfs ]; then
|
||
|
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
|
||
|
@@ -117,52 +161,9 @@ if [ "$types" = btrfs ]; then
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
- rmdir "$tmpmnt" || true
|
||
|
if [ "$found" ]; then
|
||
|
+ rmdir "$tmpmnt" || true
|
||
|
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
|
||
|
-else
|
||
|
- ro_partition "$partition"
|
||
|
- for type in $types; do
|
||
|
- if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
|
||
|
- debug "mounted as $type filesystem"
|
||
|
- mounted=1
|
||
|
- break
|
||
|
- fi
|
||
|
- done
|
||
|
-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"
|
||
|
- if ! umount "$tmpmnt"; then
|
||
|
- warn "failed to umount $tmpmnt"
|
||
|
- fi
|
||
|
- rmdir "$tmpmnt" || true
|
||
|
- exit 0
|
||
|
- fi
|
||
|
- fi
|
||
|
- done
|
||
|
- if ! umount "$tmpmnt"; then
|
||
|
- warn "failed to umount $tmpmnt"
|
||
|
fi
|
||
|
fi
|
||
|
|