Fix shellcheck issues

This commit is contained in:
Darko Poljak 2019-04-09 22:44:40 +02:00
parent f6b318bb00
commit 671bb82a46
3 changed files with 13 additions and 9 deletions

View file

@ -274,11 +274,14 @@ shellcheck-local-gencodes:
shellcheck-remote-gencodes:
@find cdist/conf/type -type f -name gencode-remote -exec $(SHELLCHECKCMD) {} + | $(SHELLCHECK_SKIP) || exit 0
shellcheck-scripts:
@$(SHELLCHECKCMD) scripts/debug-dump.sh || exit 0
shellcheck-gencodes: shellcheck-local-gencodes shellcheck-remote-gencodes
shellcheck-types: shellcheck-type-explorers shellcheck-manifests shellcheck-gencodes
shellcheck: shellcheck-global-explorers shellcheck-types
shellcheck: shellcheck-global-explorers shellcheck-types shellcheck-scripts
shellcheck-type-files:
@find cdist/conf/type -type f -path "*/files/*" -exec $(SHELLCHECKCMD) {} + | $(SHELLCHECK_SKIP) || exit 0

View file

@ -69,6 +69,7 @@ while read -r key; do
set -- "$@" --key "$key"
set -- "$@" --state "$state"
if [ -f "$__object/parameter/option" ]; then
# shellcheck disable=SC2046
set -- "$@" $(printf -- '--option %s ' $(cat "$__object/parameter/option"))
fi
if [ -f "$__object/parameter/comment" ]; then

View file

@ -204,7 +204,7 @@ or=
print_verbose()
{
if [ ${verbose} -ge $1 ]
if [ "${verbose}" -ge "$1" ]
then
printf "%s\n" "$2"
fi
@ -214,7 +214,7 @@ hor_line()
{
if [ $# -gt 0 ]
then
c=$1
c="$1"
else
c='='
fi
@ -289,7 +289,7 @@ set -- '.' "$@" -exec awk -v prefix="${filename_prefix}" "{print prefix ${ln} \$
print_verbose 2 "Using cache dir: ${cache_dir}"
OLD_PWD=$(pwd)
cd "${cache_dir}"
cd "${cache_dir}" || exit
# If no host is specified then search all.
[ -z "${hosts}" ] && hosts="-"
@ -310,16 +310,16 @@ do
do
dir=$(dirname "${d}")
print_verbose 0 "target host: $(cat ${dir}/target_host), host directory: ${dir}"
hor_line
print_verbose 0 "target host: $(cat "${dir}/target_host"), host directory: ${dir}"
hor_line '='
PREV_PWD=$(pwd)
cd "${dir}"
cd "${dir}" || exit
# set -x
find "$@"
# set +x
cd "${PREV_PWD}"
cd "${PREV_PWD}" || exit
done
IFS="${OLD_IFS}"
done
cd "${OLD_PWD}"
cd "${OLD_PWD}" || exit