SHA256
1
0
forked from pool/os-prober
os-prober/os-prober-fix-btrfs-subvol-mounted-tests.patch
Andrei Borzenkov 8f472cc59a Accepting request 459143 from home:michael-chang:branches:Base:System
- Version bump to 1.74:
  * Add support for Mageia
  * Improve logging of mounting and setting partitions to ro/rw
  * Use a read-only device-mapper entry if possible rather than setting the
    underlying device to read-only.
    Note that this introduces a dependency on dmsetup on Linux architectures.
  * Remove the "blockdev --setro" code path entirely, since the read-only
    device-mapper arrangement supersedes it and should be safer
  * Make the yaboot parser more tolerant about the syntax of "append" options
  * Disable debugging if OS_PROBER_DISABLE_DEBUG is set
  * Replace basename/dirname with shell string processing
  * Fix typos in README
  * Add Devuan detection
  * Work harder to avoid trying to mount extended partitions
  * Drop " (loader)" suffixes on Microsoft operating systems
  * Add support for 4MLinux
  * Use HTTPS for Vcs-* URLs, and link to cgit rather than gitweb.
- Rediff
 * os-prober-1.49-grub2-mount.patch
 * os-prober-EFI-openSUSEfy.patch
 * os-prober-btrfs-always-detect-default.patch
 * os-prober-btrfsfix.patch
 * os-prober-dont-load-all-fs-module-and-dont-test-mount.patch
 * os-prober-fix-btrfs-subvol-mounted-tests.patch
 * os-prober-linux-distro-avoid-expensive-ld-file-test.patch
 * os-prober-linux-distro-parse-os-release.patch
- Remove patches; fixed on upstream release
 * os-prober-call-dmraid-once.patch
 * os-prober-1.49-skip-LVM2_member.patch

OBS-URL: https://build.opensuse.org/request/show/459143
OBS-URL: https://build.opensuse.org/package/show/Base:System/os-prober?expand=0&rev=73
2017-02-20 11:06:06 +00:00

107 lines
2.8 KiB
Diff

Index: os-prober/os-probes/common/50mounted-tests
===================================================================
--- os-prober.orig/os-probes/common/50mounted-tests
+++ os-prober/os-probes/common/50mounted-tests
@@ -73,10 +73,51 @@ 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
+elif dm_device="$(do_dmsetup osprober "$partition")" && \
+ [ "$dm_device" ]; then
+ for type in $types; do
+ if mountinfo=`mount -o ro -t "$type" "$dm_device" "$tmpmnt" 2>&1`; then
+ debug "mounted as $type filesystem"
+ mounted=1
+ break
+ else
+ debug "mounting $dm_device ($partition) as $type failed: $mountinfo"
+ 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"
+ 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
@@ -137,48 +178,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
-elif dm_device="$(do_dmsetup osprober "$partition")" && \
- [ "$dm_device" ]; then
- for type in $types; do
- if mountinfo=`mount -o ro -t "$type" "$dm_device" "$tmpmnt" 2>&1`; then
- debug "mounted as $type filesystem"
- mounted=1
- break
- else
- debug "mounting $dm_device ($partition) as $type failed: $mountinfo"
- 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"
- do_unmount
- exit 0
- fi
- fi
- done
-fi
-do_unmount
-
# No tests found anything.
exit 1