kas-container: Add support for multi-word --command arguments
Yet another special dance needed to preserve argument boundaries while moving them around: This trick enables kas-container shell kas.yml --command "echo it works." by keeping the command argument separate and injecting it via appropriate quoting into the argument array. Closes: #42 Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
15aaf4677b
commit
4042ef4859
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# kas - setup tool for bitbake based projects
|
# kas - setup tool for bitbake based projects
|
||||||
#
|
#
|
||||||
# Copyright (c) Siemens AG, 2018-2020
|
# Copyright (c) Siemens AG, 2018-2021
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Jan Kiszka <jan.kiszka@siemens.com>
|
# Jan Kiszka <jan.kiszka@siemens.com>
|
||||||
@ -217,10 +217,14 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do
|
|||||||
trace ${KAS_CONTAINER_COMMAND} run ${KAS_CONTAINER_IMAGE} ${KAS_CMD} --help
|
trace ${KAS_CONTAINER_COMMAND} run ${KAS_CONTAINER_IMAGE} ${KAS_CMD} --help
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
--skip|--target|--task|-c|--cmd|--command)
|
--skip|--target|--task)
|
||||||
KAS_OPTIONS="${KAS_OPTIONS} $1 $2"
|
KAS_OPTIONS="${KAS_OPTIONS} $1 $2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-c|--cmd|--command)
|
||||||
|
KAS_BITBAKE_C_OPTION_ARGS="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
KAS_EXTRA_BITBAKE_ARGS=$#
|
KAS_EXTRA_BITBAKE_ARGS=$#
|
||||||
;;
|
;;
|
||||||
@ -345,7 +349,11 @@ if [ -z "${KAS_NO_PROXY_FROM_ENV+x}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
set -- "$@" ${KAS_ISAR_ARGS} ${KAS_WITH_LOOP_DEV} ${KAS_RUNTIME_ARGS} \
|
set -- "$@" ${KAS_ISAR_ARGS} ${KAS_WITH_LOOP_DEV} ${KAS_RUNTIME_ARGS} \
|
||||||
${KAS_CONTAINER_IMAGE} ${KAS_OPTIONS_DIRECT} ${KAS_CMD} ${KAS_OPTIONS} ${KAS_FILES}
|
${KAS_CONTAINER_IMAGE} ${KAS_OPTIONS_DIRECT} ${KAS_CMD} ${KAS_OPTIONS}
|
||||||
|
if [ -n "${KAS_BITBAKE_C_OPTION_ARGS}" ]; then
|
||||||
|
set -- "$@" -c "${KAS_BITBAKE_C_OPTION_ARGS}"
|
||||||
|
fi
|
||||||
|
set -- "$@" ${KAS_FILES}
|
||||||
|
|
||||||
# rotate any extra bitbake args from the front to the end of the argument list
|
# rotate any extra bitbake args from the front to the end of the argument list
|
||||||
while [ $KAS_EXTRA_BITBAKE_ARGS -gt 0 ]; do
|
while [ $KAS_EXTRA_BITBAKE_ARGS -gt 0 ]; do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user