Skip to content

Commit 80c7e3d

Browse files
committed
make-initrd: Reorder arguments and make variables in the command line
Some users use the make feature that allows to override makefile variables via command line. In this case, the order in which arguments and variables are specified is important because the make-initrd utility analyzes its arguments. Correct order: make-initrd uki UKI_FEATURES=foo UKI_IMAGEFILE=/tmp/uki.efi Bad order: make-initrd UKI_FEATURES=foo UKI_IMAGEFILE=/tmp/uki.efi uki To avoid such issues it is necessary to reorder the arguments and move the variables after the normal arguments. Signed-off-by: Alexey Gladkov <[email protected]>
1 parent 6e09ec4 commit 80c7e3d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

utils/make-initrd/make-initrd.in

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,18 @@ while :; do
150150
shift
151151
done
152152

153+
args=()
154+
vars=()
155+
156+
for a in "$@"; do
157+
case "$a" in
158+
[!=]*=*) vars+=("$a") ;;
159+
*) args+=("$a") ;;
160+
esac
161+
done
162+
163+
set -- "${args[@]}"
164+
153165
case "${1-}" in
154166
guess-config|bug-report)
155167
;;
@@ -249,4 +261,4 @@ case "$make_version" in
249261
esac
250262

251263
make $output_sync --no-print-directory -r \
252-
-f @projectdir@/mk/main.mk -- "$@" 4>&1 >&2
264+
-f @projectdir@/mk/main.mk -- "$@" "${vars[@]}" 4>&1 >&2

0 commit comments

Comments
 (0)