kas-container: make sure that we pass shellcheck

There is one actual change where code gets touched, the rest are just
comments to satisfy shellcheck.
All the lines with the ignores should be reviewed later, there might be
problems behind the findings.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
[Jan: add one more SC2086 suppression]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Henning Schild 2021-01-29 14:19:02 +01:00 committed by Jan Kiszka
parent 4042ef4859
commit 111906f804

View File

@ -142,6 +142,8 @@ while [ $# -gt 0 ]; do
sudo_message="[sudo] enter password to setup loop"
sudo_message="$sudo_message devices by calling"
sudo_message="$sudo_message '$sudo_command': "
# SC2086: Double quote to prevent globbing and word splitting.
# shellcheck disable=2086
if ! KAS_LOOP_DEV=$(sudo -p "$sudo_message" $sudo_command \
2>/dev/null); then
echo "Error: loop device setup unsuccessful!"
@ -185,6 +187,8 @@ while [ $# -gt 0 ]; do
KAS_CLEAN_DIR=build/tmp
if [ -n "${KAS_ISAR_ARGS}" ]; then
set_container_image_var
# SC2086: Double quote to prevent globbing and word splitting.
# shellcheck disable=2086
trace ${KAS_CONTAINER_COMMAND} run -v "${KAS_WORK_DIR}":/work:rw \
--workdir=/work --rm ${KAS_ISAR_ARGS} \
${KAS_CONTAINER_IMAGE} \
@ -214,6 +218,8 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do
case "$1" in
-h|--help)
set_container_image_var
# SC2086: Double quote to prevent globbing and word splitting.
# shellcheck disable=2086
trace ${KAS_CONTAINER_COMMAND} run ${KAS_CONTAINER_IMAGE} ${KAS_CMD} --help
exit 0
;;
@ -234,6 +240,8 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do
;;
*)
KAS_FILES=
# SC2086: Double quote to prevent globbing and word splitting.
# shellcheck disable=2086
for FILE in $(IFS=':'; echo $1); do
if ! KAS_REAL_FILE="$(realpath -qe "$FILE")"; then
echo "Error: configuration file '${FILE}' not found"
@ -253,7 +261,7 @@ done
[ -n "${KAS_FIRST_FILE}" ] || usage
BUILD_SYSTEM=$(cat ${KAS_FIRST_FILE} 2>/dev/null| grep "^build_system: " | sed 's/build_system:[ ]\+//')
BUILD_SYSTEM=$(grep -e "^build_system: " "${KAS_FIRST_FILE}" 2>/dev/null | sed 's/build_system:[ ]\+//')
if [ "${BUILD_SYSTEM}" = "isar" ]; then
enable_isar_mode
fi
@ -348,11 +356,15 @@ if [ -z "${KAS_NO_PROXY_FROM_ENV+x}" ]; then
done
fi
# SC2086: Double quote to prevent globbing and word splitting.
# shellcheck disable=2086
set -- "$@" ${KAS_ISAR_ARGS} ${KAS_WITH_LOOP_DEV} ${KAS_RUNTIME_ARGS} \
${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
# SC2086: Double quote to prevent globbing and word splitting.
# shellcheck disable=2086
set -- "$@" ${KAS_FILES}
# rotate any extra bitbake args from the front to the end of the argument list