2015-10-20 20:38:28 +00:00
|
|
|
Index: os-prober/common.sh
|
2014-04-24 20:25:42 +00:00
|
|
|
===================================================================
|
2015-10-20 20:38:28 +00:00
|
|
|
--- os-prober.orig/common.sh
|
|
|
|
+++ os-prober/common.sh
|
2013-02-05 18:17:40 +00:00
|
|
|
@@ -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
|
2015-10-20 20:38:28 +00:00
|
|
|
Index: os-prober/linux-boot-prober
|
2014-04-24 20:25:42 +00:00
|
|
|
===================================================================
|
2015-10-20 20:38:28 +00:00
|
|
|
--- os-prober.orig/linux-boot-prober
|
|
|
|
+++ os-prober/linux-boot-prober
|
2013-02-05 18:17:40 +00:00
|
|
|
@@ -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
|
2014-04-24 20:25:42 +00:00
|
|
|
@@ -19,6 +27,7 @@ bootuuid=
|
|
|
|
|
|
|
|
grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
|
2013-02-05 18:17:40 +00:00
|
|
|
|
|
|
|
+( (
|
2014-04-24 20:25:42 +00:00
|
|
|
if [ -z "$1" ]; then
|
|
|
|
ERR=y
|
|
|
|
elif [ "$1" = btrfs -a -z "$2" ]; then
|
2013-02-05 18:17:40 +00:00
|
|
|
@@ -186,3 +195,5 @@ else
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
+) 9>&1 | logger 1>&- # fd_logger
|
|
|
|
+) 3>&1 # fd_result
|
2015-10-20 20:38:28 +00:00
|
|
|
Index: os-prober/os-prober
|
2014-04-24 20:25:42 +00:00
|
|
|
===================================================================
|
2015-10-20 20:38:28 +00:00
|
|
|
--- os-prober.orig/os-prober
|
|
|
|
+++ os-prober/os-prober
|
2013-02-05 18:17:40 +00:00
|
|
|
@@ -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
|
2015-10-20 20:38:28 +00:00
|
|
|
@@ -136,6 +143,7 @@ fi
|
2013-02-05 18:17:40 +00:00
|
|
|
|
|
|
|
: >"$OS_PROBER_TMP/btrfs-vols"
|
|
|
|
|
|
|
|
+( (
|
|
|
|
for partition in $(partitions); do
|
|
|
|
if ! mapped="$(mapdevfs "$partition")"; then
|
|
|
|
log "Device '$partition' does not exist; skipping"
|
2015-10-20 20:38:28 +00:00
|
|
|
@@ -200,3 +208,5 @@ for partition in $(partitions); do
|
2013-02-05 18:17:40 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
+) 9>&1 | logger 1>&- # fd_logger
|
|
|
|
+) 3>&1 # fd_result
|