Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tools/create-initrd
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ printf '%s\n' "${!DIRS[@]}" |xargs -r put-tree .
printf '%s\n' "${!FILES[@]}" |xargs -r put-file .
printf '%s\n' "${!LOCALFILES[@]}" |xargs -r put-file -r "$LOCALBUILDDIR" .

gen-ld-so-conf . > etc/ld.so.conf

ln_if_missing "$UDEVD" ./sbin/udevd
ln_if_missing "$UDEVADM" ./sbin/udevadm

Expand Down
43 changes: 43 additions & 0 deletions tools/gen-ld-so-conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash -eu
# SPDX-License-Identifier: GPL-3.0-or-later

root="$1"; shift
[ -d "$root" ] || exit 1
[ -s /etc/ld.so.conf ] || exit 0

parse_glob() {
local g="$1"; shift
local f

for f in $g; do
if [ -s "$f" ]; then
parse_config "$f"
fi
done
}

parse_config() {
local f="$1"; shift
local dname="${f%/*}"
local w rest

while read -r w rest; do {
case "$w" in
'#'*|'') ;;
include)
if [ -z "${rest##/*}" ]; then
parse_glob "$rest"
else
parse_glob "$dname/$rest"
fi
;;
*)
if [ -z "$rest" ] && [ -d "$root$w" ]; then
printf '%s\n' "$w"
fi
;;
esac
} </dev/null; done < "$f"
}

parse_config /etc/ld.so.conf