Update to upstream version 1.70, fixes #1275641

- Fix bug #1236358 - os-prober duplicates grub entries for read/write btrfs
  subvolumes, thanks to Helmut Horvath
- Fix bug #1236649 - os-prober does not detect os on btrfs partition without
  any subvolume
This commit is contained in:
Hedayat Vatankhah 2015-11-13 23:20:01 +03:30
parent 8cef6cc5ea
commit 34d09c6def
4 changed files with 78 additions and 38 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@
/os-prober_1.58.tar.gz
/os-prober_1.65.tar.xz
/os-prober_1.68.tar.xz
/os-prober_1.70.tar.xz

View File

@ -340,7 +340,7 @@ Index: os-prober/os-probes/common/50mounted-tests
fi
for type in $(grep -v nodev /proc/filesystems); do
# hfsplus filesystems are mountable as hfs. Try hfs last so
@@ -46,6 +62,76 @@ if [ ! -d "$tmpmnt" ]; then
@@ -46,6 +62,108 @@ if [ ! -d "$tmpmnt" ]; then
fi
mounted=
@ -361,51 +361,83 @@ Index: os-prober/os-probes/common/50mounted-tests
+ # 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 9)
+ sssubvols=$(btrfs subvolume list -s "$tmpmnt" | cut -d ' ' -f 14)
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount btrfs volume on $tmpmnt"
+ rmdir "$tmpmnt" || true
+ exit 1
+ fi
+ if [ -z "$subvols" ]; then
+ debug "no subvols found on btrfs volume $UUID"
+ exit 1
+ fi
+
+ found=
+ for subvol in $subvols; do
+ debug "begin btrfs processing for $UUID subvol=$subvol"
+ if echo "$rosubvols" | grep -q -x "$subvol"; then
+ continue
+ mounted=
+
+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | cut -d ' ' -f 5)"
+ if [ -n "$mpoint" -a "x$mpoint" = "x/" ]; then
+ debug "This is the root for the running system" #running system must be done elsewhere
+ else
+ #partition was not root of running system, so lets look for bootable subvols
+ if [ -n "$mpoint" ] ; then
+ mounted=1 #partition was already mounted,so lets not unmount it when done
+ else
+ # again, do not mount btrfs ro
+ mount -t btrfs -U "$UUID" "$tmpmnt"
+ mpoint="$tmpmnt"
+ fi
+
+ test="/usr/libexec/os-probes/mounted/90linux-distro"
+ if [ -f "$test" ] && [ -x "$test" ]; then
+ debug "running subtest $test"
+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID"; then
+ debug "os found by subtest $test on $partition"
+ found=1
+ fi
+ if echo "$sssubvols" | grep -q -x "$subvol"; then
+ continue
+ fi
+ if [ -z "$mounted" ]; then
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount $tmpmnt"
+ fi
+ mounted=
+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)"
+ if [ -n "$mpoint" ]; then
+ if [ "x$mpoint" = "x/" ]; then
+ continue # this is the root for the running system
+ fi
+ fi
+
+ if [ -z "$subvols" ]; then
+ debug "no subvols found on btrfs volume $UUID"
+ else
+ found=
+ for subvol in $subvols; do
+ debug "begin btrfs processing for $UUID subvol=$subvol"
+ if echo "$rosubvols" | grep -q -x "$subvol"; then
+ continue
+ fi
+ mounted=1
+ else
+ # again, do not mount btrfs ro
+ mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt"
+ mpoint="$tmpmnt"
+ fi
+ test="/usr/lib/os-probes/mounted/90linux-distro"
+ if [ -f "$test" ] && [ -x "$test" ]; then
+ debug "running subtest $test"
+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then
+ debug "os found by subtest $test on subvol $subvol"
+ found=1
+ if echo "$sssubvols" | grep -q -x "$subvol"; then
+ continue
+ fi
+ fi
+ if [ -z "$mounted" ]; then
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount $tmpmnt"
+ mounted=
+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)"
+ if [ -n "$mpoint" ]; then
+ if [ "x$mpoint" = "x/" ]; then
+ continue # this is the root for the running system
+ fi
+ mounted=1
+ else
+ # again, do not mount btrfs ro
+ mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt"
+ mpoint="$tmpmnt"
+ fi
+ fi
+ done
+ test="/usr/lib/os-probes/mounted/90linux-distro"
+ if [ -f "$test" ] && [ -x "$test" ]; then
+ debug "running subtest $test"
+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then
+ debug "os found by subtest $test on subvol $subvol"
+ found=1
+ fi
+ fi
+ if [ -z "$mounted" ]; then
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount $tmpmnt"
+ fi
+ fi
+ done
+ fi
+ rmdir "$tmpmnt" || true
+ if [ "$found" ]; then
+ exit 0

View File

@ -1,5 +1,5 @@
Name: os-prober
Version: 1.68
Version: 1.70
Release: 1%{?dist}
Summary: Probes disks on the system for installed operating systems
@ -38,7 +38,7 @@ in a generic machine-readable format. Support for new OSes and Linux
distributions can be added easily.
%prep
%setup -q -n os-prober
%setup -q
%patch0 -p1 -b .newnsdirfix
%patch1 -p1 -b .macosxdummyfix
%patch2 -p1 -b .mdraidfix
@ -105,6 +105,13 @@ fi
%{_var}/lib/%{name}
%changelog
* Fri Nov 13 2015 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.70-1
- Update to upstream version 1.70, fixes #1275641
- Fix bug #1236358 - os-prober duplicates grub entries for read/write btrfs
subvolumes, thanks to Helmut Horvath
- Fix bug #1236649 - os-prober does not detect os on btrfs partition without
any subvolume
* Tue Oct 20 2015 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.68-1
- Update to upstream version 1.68, bug #1267779
- Support a case where a kernel named vmlinuz/x is used under Gentoo, bug #1223237

View File

@ -1 +1 @@
11e9794cc4bfd77092c76d9d96a2035b os-prober_1.68.tar.xz
c1cfdd90dc958f12b932ccc8d64051e1 os-prober_1.70.tar.xz