Skip to content

Commit 61b3499

Browse files
committed
Merge branch 'github-pull-43'
Improve portability with other linux distributions. Signed-off-by: Alexey Gladkov <[email protected]>
2 parents 98602a6 + c3b8312 commit 61b3499

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

tools/create-initrd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ printf '%s\n' "${!DIRS[@]}" |xargs -r put-tree .
282282
printf '%s\n' "${!FILES[@]}" |xargs -r put-file .
283283
printf '%s\n' "${!LOCALFILES[@]}" |xargs -r put-file -r "$LOCALBUILDDIR" .
284284

285+
gen-ld-so-conf . > etc/ld.so.conf
286+
285287
ln_if_missing "$UDEVD" ./sbin/udevd
286288
ln_if_missing "$UDEVADM" ./sbin/udevadm
287289

tools/gen-ld-so-conf

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash -eu
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
root="$1"; shift
5+
[ -d "$root" ] || exit 1
6+
[ -s /etc/ld.so.conf ] || exit 0
7+
8+
parse_glob() {
9+
local g="$1"; shift
10+
local f
11+
12+
for f in $g; do
13+
if [ -s "$f" ]; then
14+
parse_config "$f"
15+
fi
16+
done
17+
}
18+
19+
parse_config() {
20+
local f="$1"; shift
21+
local dname="${f%/*}"
22+
local w rest
23+
24+
while read -r w rest; do {
25+
case "$w" in
26+
'#'*|'') ;;
27+
include)
28+
if [ -z "${rest##/*}" ]; then
29+
parse_glob "$rest"
30+
else
31+
parse_glob "$dname/$rest"
32+
fi
33+
;;
34+
*)
35+
if [ -z "$rest" ] && [ -d "$root$w" ]; then
36+
printf '%s\n' "$w"
37+
fi
38+
;;
39+
esac
40+
} </dev/null; done < "$f"
41+
}
42+
43+
parse_config /etc/ld.so.conf

0 commit comments

Comments
 (0)