Skip to content

Commit a012042

Browse files
Böszörményi Zoltánharaldh
authored andcommitted
Allow running on a cross-compiled rootfs
For the shell scripts, new environment variables were introduced. dracutsysrootdir is the root directory, file existence checks use it. DRACUT_LDCONFIG can override ldconfig with a different one that works on the sysroot with foreign binaries. DRACUT_LDD can override ldd with a different one that works with foreign binaries. DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot may use symlinks that are valid only when running on the target so a real file must be provided that exist in the sysroot. DRACUT_INSTALL now supports debugging dracut-install in itself when run by dracut but without debugging the dracut scripts. E.g. DRACUT_INSTALL="valgrind dracut-install or DRACUT_INSTALL="dracut-install --debug". DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2, DRACUT_COMPRESS_LZMA, DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP, DRACUT_COMPRESS_PIGZ, DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD, DRACUT_COMPRESS_LZ4, DRACUT_COMPRESS_CAT: All of the compression utilities may be overridden, to support the native binaries in non-standard places. DRACUT_ARCH overrides "uname -m". SYSTEMD_VERSION overrides "systemd --version". The dracut-install utility was overhauled to support sysroot via a new option -r and fixes for clang-analyze. It supports cross-compiler-ldd from https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f DRACUT_INSTALL_PATH was introduced so dracut-install can work with a different PATH. In a cross-compiled environment (e.g. Yocto), PATH points to natively built binaries that are not in the host's /bin, /usr/bin, etc. dracut-install still needs plain /bin and /usr/bin that are relative to the cross-compiled sysroot. The hashmap pool allocate_tile/deallocate_tile code was removed because clang-analyze showed errors in it. hashmap_copy was removed because it wasn't used and clang-analyze showed errors in it. DRACUT_INSTALL_LOG_TARGET and DRACUT_INSTALL_LOG_LEVEL were introduced so dracut-install can use different settings from DRACUT_LOG_TARGET and DRACUT_LOG_LEVEL. Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
1 parent 89bc1aa commit a012042

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+586
-425
lines changed

dracut-functions.sh

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,43 @@ str_ends() { [ "${1%*"$2"}" != "$1" ]; }
4040
# find a binary. If we were not passed the full path directly,
4141
# search in the usual places to find the binary.
4242
find_binary() {
43-
if [[ -z ${1##/*} ]]; then
44-
if [[ -x $1 ]] || { [[ "$1" == *.so* ]] && ldd "$1" &>/dev/null; }; then
43+
local _delim
44+
local l
45+
local p
46+
[[ -z ${1##/*} ]] || _delim="/"
47+
48+
if [[ "$1" == *.so* ]]; then
49+
for l in libdirs ; do
50+
if { $DRACUT_LDD "$dracutsysrootdir$l$_delim$1" &>/dev/null; }; then
51+
printf "%s\n" "$1"
52+
return 0
53+
fi
54+
done
55+
if { $DRACUT_LDD "$dracutsysrootdir$_delim$1" &>/dev/null; }; then
4556
printf "%s\n" "$1"
4657
return 0
4758
fi
4859
fi
60+
if [[ "$1" == */* ]]; then
61+
if [[ -L $dracutsysrootdir$_delim$1 ]] || [[ -x $dracutsysrootdir$_delim$1 ]]; then
62+
printf "%s\n" "$1"
63+
return 0
64+
fi
65+
fi
66+
for p in $DRACUT_PATH ; do
67+
if [[ -L $dracutsysrootdir$p$_delim$1 ]] || [[ -x $dracutsysrootdir$p$_delim$1 ]]; then
68+
printf "%s\n" "$1"
69+
return 0
70+
fi
71+
done
4972

73+
[[ -n "$dracutsysrootdir" ]] && return 1
5074
type -P "${1##*/}"
5175
}
5276

5377
ldconfig_paths()
5478
{
55-
ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
79+
$DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
5680
}
5781

5882
# Version comparision function. Assumes Linux style version scheme.
@@ -633,9 +657,9 @@ check_kernel_config()
633657
{
634658
local _config_opt="$1"
635659
local _config_file
636-
[[ -f /boot/config-$kernel ]] \
660+
[[ -f $dracutsysrootdir/boot/config-$kernel ]] \
637661
&& _config_file="/boot/config-$kernel"
638-
[[ -f /lib/modules/$kernel/config ]] \
662+
[[ -f $dracutsysrootdir/lib/modules/$kernel/config ]] \
639663
&& _config_file="/lib/modules/$kernel/config"
640664
641665
# no kernel config file, so return true

dracut-init.sh

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ if ! [[ $kernel ]]; then
5757
export kernel
5858
fi
5959

60-
srcmods="/lib/modules/$kernel/"
60+
srcmods="$dracutsysrootdir/lib/modules/$kernel/"
6161

6262
[[ $drivers_dir ]] && {
6363
if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
@@ -79,17 +79,21 @@ export srcmods
7979
export hookdirs
8080
}
8181

82+
DRACUT_LDD=${DRACUT_LDD:-ldd}
83+
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
84+
DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}
85+
8286
. $dracutbasedir/dracut-functions.sh
8387

8488
# Detect lib paths
8589
if ! [[ $libdirs ]] ; then
86-
if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \
87-
&& [[ -d /lib64 ]]; then
90+
if [[ "$($DRACUT_LDD $dracutsysrootdir$DRACUT_TESTBIN)" == */lib64/* ]] &>/dev/null \
91+
&& [[ -d $dracutsysrootdir/lib64 ]]; then
8892
libdirs+=" /lib64"
89-
[[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
93+
[[ -d $dracutsysrootdir/usr/lib64 ]] && libdirs+=" /usr/lib64"
9094
else
9195
libdirs+=" /lib"
92-
[[ -d /usr/lib ]] && libdirs+=" /usr/lib"
96+
[[ -d $dracutsysrootdir/usr/lib ]] && libdirs+=" /usr/lib"
9397
fi
9498

9599
libdirs+=" $(ldconfig_paths)"
@@ -168,23 +172,34 @@ elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]];
168172
DRACUT_INSTALL=$dracutbasedir/install/dracut-install
169173
fi
170174

171-
if ! [[ -x $DRACUT_INSTALL ]]; then
175+
# Test if dracut-install is a standalone executable with no options.
176+
# E.g. DRACUT_INSTALL may be set externally as:
177+
# DRACUT_INSTALL="valgrind dracut-install"
178+
# or
179+
# DRACUT_INSTALL="dracut-install --debug"
180+
# in which case the string cannot be tested for being executable.
181+
DRINSTALLPARTS=0
182+
for i in $DRACUT_INSTALL ; do
183+
DRINSTALLPARTS=$(($DRINSTALLPARTS+1))
184+
done
185+
186+
if [[ $DRINSTALLPARTS = 1 ]] && ! [[ -x $DRACUT_INSTALL ]]; then
172187
dfatal "dracut-install not found!"
173188
exit 10
174189
fi
175190

176191
if [[ $hostonly == "-h" ]]; then
177192
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
178193
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
179-
$DRACUT_INSTALL ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
194+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
180195
fi
181196
fi
182197

183198
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
184199
inst_dir() {
185200
[[ -e ${initdir}/"$1" ]] && return 0 # already there
186-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@"
187-
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || :
201+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"
202+
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@" || :
188203
}
189204

190205
inst() {
@@ -194,8 +209,8 @@ inst() {
194209
shift
195210
fi
196211
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
197-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
198-
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
212+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
213+
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
199214
}
200215

201216
inst_simple() {
@@ -206,8 +221,8 @@ inst_simple() {
206221
fi
207222
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
208223
[[ -e $1 ]] || return 1 # no source
209-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
210-
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
224+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
225+
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
211226
}
212227

213228
inst_symlink() {
@@ -218,15 +233,15 @@ inst_symlink() {
218233
fi
219234
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
220235
[[ -L $1 ]] || return 1
221-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
222-
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
236+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
237+
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
223238
}
224239

225240
inst_multiple() {
226241
local _ret
227-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
242+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
228243
_ret=$?
229-
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
244+
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
230245
return $_ret
231246
}
232247

@@ -243,8 +258,9 @@ dracut_instmods() {
243258
done
244259

245260
$DRACUT_INSTALL \
261+
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
246262
${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
247-
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
263+
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
248264
}
249265

250266
inst_library() {
@@ -255,24 +271,24 @@ inst_library() {
255271
fi
256272
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
257273
[[ -e $1 ]] || return 1 # no source
258-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
259-
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
274+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
275+
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
260276
}
261277

262278
inst_binary() {
263-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
264-
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
279+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
280+
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
265281
}
266282

267283
inst_script() {
268-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
269-
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
284+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
285+
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
270286
}
271287

272288
inst_fsck_help() {
273289
local _helper="/run/dracut/fsck/fsck_help_$1.txt"
274-
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
275-
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
290+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
291+
(($? != 0)) && derror $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
276292
}
277293

278294
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
@@ -369,12 +385,12 @@ inst_rule_group_owner() {
369385

370386
for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
371387
if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
372-
grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
388+
grep -E "^$i:" $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
373389
fi
374390
done
375391
for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
376392
if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
377-
grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
393+
grep -E "^$i:" $dracutsysrootdir/etc/group 2>/dev/null >> "$initdir/etc/group"
378394
fi
379395
done
380396
}
@@ -394,7 +410,7 @@ inst_rules() {
394410
inst_dir "$_target"
395411
for _rule in "$@"; do
396412
if [ "${_rule#/}" = "$_rule" ]; then
397-
for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
413+
for r in $dracutsysrootdir${udevdir}/rules.d ${hostonly:+$dracutsysrootdir/etc/udev/rules.d}; do
398414
[[ -e $r/$_rule ]] || continue
399415
_found="$r/$_rule"
400416
inst_rule_programs "$_found"
@@ -403,7 +419,7 @@ inst_rules() {
403419
inst_simple "$_found"
404420
done
405421
fi
406-
for r in '' $dracutbasedir/rules.d/; do
422+
for r in '' $dracutsysrootdir$dracutbasedir/rules.d/; do
407423
# skip rules without an absolute path
408424
[[ "${r}$_rule" != /* ]] && continue
409425
[[ -f ${r}$_rule ]] || continue
@@ -525,15 +541,15 @@ inst_libdir_file() {
525541
for _i in "$@"; do
526542
for _f in "$_dir"/$_i; do
527543
[[ "$_f" =~ $_pattern ]] || continue
528-
[[ -e "$_f" ]] && _files+="$_f "
544+
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
529545
done
530546
done
531547
done
532548
else
533549
for _dir in $libdirs; do
534550
for _i in "$@"; do
535551
for _f in "$_dir"/$_i; do
536-
[[ -e "$_f" ]] && _files+="$_f "
552+
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
537553
done
538554
done
539555
done
@@ -947,6 +963,7 @@ instmods() {
947963

948964
$DRACUT_INSTALL \
949965
${initdir:+-D "$initdir"} \
966+
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
950967
${loginstall:+-L "$loginstall"} \
951968
${hostonly:+-H} \
952969
${omit_drivers:+-N "$omit_drivers"} \
@@ -960,6 +977,7 @@ instmods() {
960977
derror "FAILED: " \
961978
$DRACUT_INSTALL \
962979
${initdir:+-D "$initdir"} \
980+
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
963981
${loginstall:+-L "$loginstall"} \
964982
${hostonly:+-H} \
965983
${omit_drivers:+-N "$omit_drivers"} \

0 commit comments

Comments
 (0)