[os-prober] Fix a bug in recent btrfs patch when an extended partition is examined.
Hedayat Vatankhah
hedayat at fedoraproject.org
Tue Feb 5 18:19:01 UTC 2013
commit 1cc85085b1fb5ddf7e66548f2db7808397f23c11
Author: Hedayat Vatankhah <hedayat.fwd at gmail.com>
Date: Tue Feb 5 21:47:40 2013 +0330
Fix a bug in recent btrfs patch when an extended partition is examined.
(H.J. Lu) (bug #906847)
- Fix naming of /boot partitions according to their fstab entry (bug #893472)
- Don't generate .btrfsfix files which will be included in final rpm
- Fix wrong boot partition set by linux-boot-prober when / and /boot are
mounted (bug #906886)
- Factor out 'logger', so that it is run once and logs are piped to it (John
Reiser) (bug #875356)
os-prober-bootpart-name-fix.patch | 28 +++++++++
os-prober-btrfsfix.patch | 2 +-
os-prober-factor-out-logger.patch | 104 ++++++++++++++++++++++++++++++++
os-prober-mounted-partitions-fix.patch | 24 +++++++
os-prober.spec | 26 +++++++--
5 files changed, 178 insertions(+), 6 deletions(-)
---
diff --git a/os-prober-bootpart-name-fix.patch b/os-prober-bootpart-name-fix.patch
new file mode 100644
index 0000000..27988ec
--- /dev/null
+++ b/os-prober-bootpart-name-fix.patch
@@ -0,0 +1,28 @@
+diff -up os-prober-1.57/common.sh.bootpartnamefix os-prober-1.57/common.sh
+--- os-prober-1.57/common.sh.bootpartnamefix 2013-02-03 23:56:39.585511891 +0330
++++ os-prober-1.57/common.sh 2013-02-05 19:42:14.652151904 +0330
+@@ -246,7 +246,7 @@ linux_mount_boot () {
+ if [ "$bindfrom" != "$tmpmnt/boot" ]; then
+ if mount --bind "$bindfrom" "$tmpmnt/boot"; then
+ mounted=1
+- bootpart="$1"
++ bootpart="$tmppart"
+ else
+ debug "failed to bind-mount $bindfrom onto $tmpmnt/boot"
+ fi
+@@ -254,6 +254,15 @@ linux_mount_boot () {
+ fi
+ if [ "$mounted" ]; then
+ :
++ elif [ -e "$tmppart" ]; then
++ bootpart="$tmppart"
++ boottomnt="$tmppart"
++ elif [ -e "$tmpmnt/$tmppart" ]; then
++ bootpart="$tmppart"
++ boottomnt="$tmpmnt/$tmppart"
++ elif [ -e "/target/$tmppart" ]; then
++ bootpart="$tmppart"
++ boottomnt="/target/$tmppart"
+ elif [ -e "$1" ]; then
+ bootpart="$1"
+ boottomnt="$1"
diff --git a/os-prober-btrfsfix.patch b/os-prober-btrfsfix.patch
index c14b8e6..2ad2002 100644
--- a/os-prober-btrfsfix.patch
+++ b/os-prober-btrfsfix.patch
@@ -253,7 +253,7 @@
- if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then
+ # do btrfs processing here; both mounted and unmounted will
+ # be handled by 50mounted-tests so we can do a subvol only once.
-+ type=$(blkid -o value -s TYPE $mapped)
++ type=$(blkid -o value -s TYPE $mapped || true)
+ if [ "$type" = btrfs ]; then
+ uuid=$(blkid -o value -s UUID $mapped)
+ if grep -q "^$uuid" "$OS_PROBER_TMP/btrfs-vols" ; then
diff --git a/os-prober-factor-out-logger.patch b/os-prober-factor-out-logger.patch
new file mode 100644
index 0000000..7708bc9
--- /dev/null
+++ b/os-prober-factor-out-logger.patch
@@ -0,0 +1,104 @@
+diff -up os-prober-1.57/common.sh.logger-factor-out os-prober-1.57/common.sh
+--- os-prober-1.57/common.sh.logger-factor-out 2013-02-05 21:19:38.896088800 +0330
++++ os-prober-1.57/common.sh 2013-02-05 21:20:04.624767147 +0330
+@@ -62,10 +62,14 @@ cache_progname() {
+ esac
+ }
+
+-log() {
+- cache_progname
+- logger -t "$progname" "$@"
+-}
++# fd_logger: bind value now, possibly after assigning default.
++eval '
++ log() {
++ cache_progname
++ echo "$progname: $@" 1>&'${fd_logger:=9}'
++ }
++'
++export fd_logger # so subshells inherit current value by default
+
+ error() {
+ log "error: $@"
+@@ -81,10 +85,14 @@ debug() {
+ fi
+ }
+
+-result () {
+- log "result:" "$@"
+- echo "$@"
+-}
++# fd_result: bind value now, possibly after assigning default.
++eval '
++ result() {
++ log "result:" "$@"
++ echo "$@" 1>&'${fd_result:=1}'
++ }
++'
++export fd_result # so subshells inherit current value by default
+
+ # shim to make it easier to use os-prober outside d-i
+ if ! type mapdevfs >/dev/null 2>&1; then
+diff -up os-prober-1.57/linux-boot-prober.logger-factor-out os-prober-1.57/linux-boot-prober
+--- os-prober-1.57/linux-boot-prober.logger-factor-out 2013-02-05 21:19:59.395832518 +0330
++++ os-prober-1.57/linux-boot-prober 2013-02-05 21:24:42.301295713 +0330
+@@ -1,4 +1,12 @@
+ #!/bin/sh
++
++# dash shell does not have "{varname}>&1" feature that bash shell has
++# for auto-assignment of new filedescriptors.
++# It is cumbersome to write the 'eval' to use our own variables in redirections.
++# Therefore use fixed numbers.
++export fd_result=3 # file descriptor for external results
++export fd_logger=9 # file descriptor for input to logger
++
+ . /usr/share/os-prober/common.sh
+
+ set -e
+@@ -147,6 +155,7 @@ if ! mapped="$(mapdevfs "$partition")";
+ continue
+ fi
+
++( (
+ if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then
+ for test in /usr/lib/linux-boot-probes/*; do
+ if [ -x $test ] && [ -f $test ]; then
+@@ -186,3 +195,5 @@ else
+ fi
+ fi
+ fi
++) 9>&1 | logger 1>&- # fd_logger
++) 3>&1 # fd_result
+diff -up os-prober-1.57/os-prober.logger-factor-out os-prober-1.57/os-prober
+--- os-prober-1.57/os-prober.logger-factor-out 2013-02-05 21:19:52.914913541 +0330
++++ os-prober-1.57/os-prober 2013-02-05 21:25:35.168634780 +0330
+@@ -1,7 +1,14 @@
+ #!/bin/sh
+ set -e
+
+-. /usr/share/os-prober/common.sh
++# dash shell does not have "{varname}>&1" feature that bash shell has
++# for auto-assignment of new filedescriptors.
++# It is cumbersome to write the 'eval' to use our own variables in redirections.
++# Therefore use fixed numbers.
++export fd_result=3 # file descriptor for external results
++export fd_logger=9 # file descriptor for input to logger
++
++ . /usr/share/os-prober/common.sh
+
+ newns "$@"
+ require_tmpdir
+@@ -129,6 +136,7 @@ fi
+
+ : >"$OS_PROBER_TMP/btrfs-vols"
+
++( (
+ for partition in $(partitions); do
+ if ! mapped="$(mapdevfs "$partition")"; then
+ log "Device '$partition' does not exist; skipping"
+@@ -193,3 +201,5 @@ for partition in $(partitions); do
+ fi
+ fi
+ done
++) 9>&1 | logger 1>&- # fd_logger
++) 3>&1 # fd_result
diff --git a/os-prober-mounted-partitions-fix.patch b/os-prober-mounted-partitions-fix.patch
new file mode 100644
index 0000000..c0341ea
--- /dev/null
+++ b/os-prober-mounted-partitions-fix.patch
@@ -0,0 +1,24 @@
+diff -up os-prober-1.57/common.sh.mounted-partitions-fix os-prober-1.57/common.sh
+--- os-prober-1.57/common.sh.mounted-partitions-fix 2013-02-05 20:58:03.041289214 +0330
++++ os-prober-1.57/common.sh 2013-02-05 20:58:03.044289177 +0330
+@@ -123,7 +123,7 @@ parse_proc_mounts () {
+ set -f
+ set -- $line
+ set +f
+- printf '%s %s %s\n' "$(mapdevfs "$1")" "$2" "$3"
++ printf '%s %s %s %s\n' "$(mapdevfs "$1")" "$2" "$3" "$1"
+ done
+ }
+
+diff -up os-prober-1.57/linux-boot-prober.mounted-partitions-fix os-prober-1.57/linux-boot-prober
+--- os-prober-1.57/linux-boot-prober.mounted-partitions-fix 2013-02-05 20:58:03.000000000 +0330
++++ os-prober-1.57/linux-boot-prober 2013-02-05 20:58:54.364647584 +0330
+@@ -167,7 +167,7 @@ else
+ bootpart="${mountboot%% *}"
+ bootmounted="${mountboot#* }"
+ else
+- bootpart="$partition"
++ bootpart="$(grep " $mpoint/boot " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 4)"
+ bootmounted=0
+ fi
+ for test in /usr/lib/linux-boot-probes/mounted/*; do
diff --git a/os-prober.spec b/os-prober.spec
index 2f498d6..4c87fa1 100644
--- a/os-prober.spec
+++ b/os-prober.spec
@@ -1,6 +1,6 @@
Name: os-prober
Version: 1.57
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Probes disks on the system for installed operating systems
Group: System Environment/Base
@@ -18,8 +18,11 @@ Patch3: os-prober-yaboot-parsefix.patch
Patch4: os-prober-usrmovefix.patch
Patch5: os-prober-remove-basename.patch
Patch6: os-prober-disable-debug-test.patch
-# To be sent upstream
Patch7: os-prober-btrfsfix.patch
+# To be sent upstream
+Patch8: os-prober-bootpart-name-fix.patch
+Patch9: os-prober-mounted-partitions-fix.patch
+Patch10: os-prober-factor-out-logger.patch
Requires: udev coreutils util-linux
Requires: grep /bin/sed /sbin/modprobe
@@ -38,7 +41,10 @@ distributions can be added easily.
%patch4 -p1
%patch5 -p1 -b .remove-basename
%patch6 -p1 -b .disable-debug-test
-%patch7 -p1 -b .btrfsfix
+%patch7 -p1
+%patch8 -p1 -b .bootpart-name-fix
+%patch9 -p1 -b .mounted-partitions-fix
+%patch10 -p1 -b .factor-out-logger
find -type f -exec sed -i -e 's|usr/lib|usr/libexec|g' {} \;
sed -i -e 's|grub-probe|grub2-probe|g' os-probes/common/50mounted-tests \
@@ -89,12 +95,22 @@ fi
%{_var}/lib/%{name}
%changelog
+* Sat Feb 02 2013 Hedayat Vatankhah <hedayat.fwd+rpmchlog at gmail.com> - 1.57-2
+- Fix a bug in recent btrfs patch when an extended partition is examined.
+ (H.J. Lu) (bug #906847)
+- Fix naming of /boot partitions according to their fstab entry (bug #893472)
+- Don't generate .btrfsfix files which will be included in final rpm
+- Fix wrong boot partition set by linux-boot-prober when / and /boot are
+ mounted (bug #906886)
+- Factor out 'logger', so that it is run once and logs are piped to it (John
+ Reiser) (bug #875356)
+
* Tue Jan 22 2013 Hedayat Vatankhah <hedayat.fwd+rpmchlog at gmail.com> - 1.57-1
- Update to 1.57 (#890409)
- Use shell string processing rather than 'basename' (#875356)
- Make it possible to disable logging debug messages by assigning a value to
- OS_PROBER_DISABLE_DEBUG environment variable (#893997).
-- Detect multi btrfs pools/volumes (#888341)
+ OS_PROBER_DISABLE_DEBUG environment variable (Gene Czarcinski) (#893997).
+- Detect multi btrfs pools/volumes (Gene Czarcinski) (#888341)
* Thu Oct 11 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog at gmail.com> - 1.56-1
- Update to 1.56 with a bug fix and applied one of my patches
More information about the scm-commits
mailing list