Skip to content

Commit 097dd36

Browse files
aafeijoo-susejohannbg
authored andcommitted
fix(dracut): shellcheck regression in DRACUT_INSTALL calls
If the DRACUT_INSTALL environment variable contains arguments (e.g.: DRACUT_INSTALL="/usr/lib/dracut/dracut-install --debug"), its call cannot be enclosed in double quotes. E.g.: ``` > export DRACUT_INSTALL="/usr/lib/dracut/dracut-install" > "$DRACUT_INSTALL" > /dev/null dracut-install: No SOURCE argument given > export DRACUT_INSTALL="/usr/lib/dracut/dracut-install --debug" > "$DRACUT_INSTALL" > /dev/null -bash: /usr/lib/dracut/dracut-install --debug: No such file or directory > $DRACUT_INSTALL > /dev/null dracut-install: No SOURCE argument given ```
1 parent e450085 commit 097dd36

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

dracut-init.sh

+12-12
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ fi
203203
if [[ $hostonly == "-h" ]]; then
204204
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f $DRACUT_KERNEL_MODALIASES ]]; then
205205
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
206-
"$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
206+
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
207207
fi
208208
fi
209209

210210
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
211211
inst_dir() {
212212
local _ret
213213
[[ -e ${initdir}/"$1" ]] && return 0 # already there
214-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"; then
214+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"; then
215215
return 0
216216
else
217217
_ret=$?
@@ -227,7 +227,7 @@ inst() {
227227
shift
228228
fi
229229
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
230-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
230+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
231231
return 0
232232
else
233233
_ret=$?
@@ -244,7 +244,7 @@ inst_simple() {
244244
fi
245245
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
246246
[[ -e $1 ]] || return 1 # no source
247-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then
247+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then
248248
return 0
249249
else
250250
_ret=$?
@@ -261,7 +261,7 @@ inst_symlink() {
261261
fi
262262
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
263263
[[ -L $1 ]] || return 1
264-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
264+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
265265
return 0
266266
else
267267
_ret=$?
@@ -276,7 +276,7 @@ inst_multiple() {
276276
_hostonly_install="-H"
277277
shift
278278
fi
279-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
279+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
280280
return 0
281281
else
282282
_ret=$?
@@ -298,7 +298,7 @@ dracut_instmods() {
298298
[[ $i == "--silent" ]] && _silent=1
299299
done
300300

301-
if "$DRACUT_INSTALL" \
301+
if $DRACUT_INSTALL \
302302
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
303303
${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"; then
304304
return 0
@@ -319,7 +319,7 @@ inst_library() {
319319
fi
320320
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
321321
[[ -e $1 ]] || return 1 # no source
322-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
322+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
323323
return 0
324324
else
325325
_ret=$?
@@ -330,7 +330,7 @@ inst_library() {
330330

331331
inst_binary() {
332332
local _ret
333-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
333+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
334334
return 0
335335
else
336336
_ret=$?
@@ -341,7 +341,7 @@ inst_binary() {
341341

342342
inst_script() {
343343
local _ret
344-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
344+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
345345
return 0
346346
else
347347
_ret=$?
@@ -352,7 +352,7 @@ inst_script() {
352352

353353
inst_fsck_help() {
354354
local _ret _helper="/run/dracut/fsck/fsck_help_$1.txt"
355-
if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper"; then
355+
if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper"; then
356356
return 0
357357
else
358358
_ret=$?
@@ -1112,7 +1112,7 @@ instmods() {
11121112
return 0
11131113
fi
11141114

1115-
"$DRACUT_INSTALL" \
1115+
$DRACUT_INSTALL \
11161116
${initdir:+-D "$initdir"} \
11171117
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
11181118
${loginstall:+-L "$loginstall"} \

dracut.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -2168,8 +2168,9 @@ if [[ $kernel_only != yes ]]; then
21682168
21692169
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
21702170
dinfo "*** Resolving executable dependencies ***"
2171+
# shellcheck disable=SC2086
21712172
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
2172-
| xargs -r -0 "$DRACUT_INSTALL" ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
2173+
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
21732174
dinfo "*** Resolving executable dependencies done ***"
21742175
fi
21752176

0 commit comments

Comments
 (0)