recipes: libs/libexecinfo: Do not strip references from libraries
[dragora.git] / patches / os-prober / os-prober-factor-out-logger.patch
blob52cb7ceabb0c3d4111a5beae168aab340e17969b
1 Index: os-prober/common.sh
2 ===================================================================
3 --- os-prober.orig/common.sh
4 +++ os-prober/common.sh
5 @@ -62,10 +62,14 @@ cache_progname() {
6 esac
9 -log() {
10 - cache_progname
11 - logger -t "$progname" "$@"
13 +# fd_logger: bind value now, possibly after assigning default.
14 +eval '
15 + log() {
16 + cache_progname
17 + echo "$progname: $@" 1>&'${fd_logger:=9}'
18 + }
20 +export fd_logger # so subshells inherit current value by default
22 error() {
23 log "error: $@"
24 @@ -81,10 +85,14 @@ debug() {
28 -result () {
29 - log "result:" "$@"
30 - echo "$@"
32 +# fd_result: bind value now, possibly after assigning default.
33 +eval '
34 + result() {
35 + log "result:" "$@"
36 + echo "$@" 1>&'${fd_result:=1}'
37 + }
39 +export fd_result # so subshells inherit current value by default
41 # shim to make it easier to use os-prober outside d-i
42 if ! type mapdevfs >/dev/null 2>&1; then
43 Index: os-prober/linux-boot-prober
44 ===================================================================
45 --- os-prober.orig/linux-boot-prober
46 +++ os-prober/linux-boot-prober
47 @@ -1,4 +1,12 @@
48 #!/bin/sh
50 +# dash shell does not have "{varname}>&1" feature that bash shell has
51 +# for auto-assignment of new filedescriptors.
52 +# It is cumbersome to write the 'eval' to use our own variables in redirections.
53 +# Therefore use fixed numbers.
54 +export fd_result=3 # file descriptor for external results
55 +export fd_logger=9 # file descriptor for input to logger
57 . /usr/share/os-prober/common.sh
59 set -e
60 @@ -19,6 +27,7 @@ bootuuid=
62 grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
64 +( (
65 if [ -z "$1" ]; then
66 ERR=y
67 elif [ "$1" = btrfs -a -z "$2" ]; then
68 @@ -186,3 +195,5 @@ else
72 +) 9>&1 | logger 1>&- # fd_logger
73 +) 3>&1 # fd_result
74 Index: os-prober/os-prober
75 ===================================================================
76 --- os-prober.orig/os-prober
77 +++ os-prober/os-prober
78 @@ -1,7 +1,14 @@
79 #!/bin/sh
80 set -e
82 -. /usr/share/os-prober/common.sh
83 +# dash shell does not have "{varname}>&1" feature that bash shell has
84 +# for auto-assignment of new filedescriptors.
85 +# It is cumbersome to write the 'eval' to use our own variables in redirections.
86 +# Therefore use fixed numbers.
87 +export fd_result=3 # file descriptor for external results
88 +export fd_logger=9 # file descriptor for input to logger
90 + . /usr/share/os-prober/common.sh
92 newns "$@"
93 require_tmpdir
94 @@ -136,6 +143,7 @@ fi
96 : >"$OS_PROBER_TMP/btrfs-vols"
98 +( (
99 for partition in $(partitions); do
100 if ! mapped="$(mapdevfs "$partition")"; then
101 log "Device '$partition' does not exist; skipping"
102 @@ -200,3 +208,5 @@ for partition in $(partitions); do
105 done
106 +) 9>&1 | logger 1>&- # fd_logger
107 +) 3>&1 # fd_result