1cc85085b1
(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)
105 lines
3.0 KiB
Diff
105 lines
3.0 KiB
Diff
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
|