diff --git a/Makefile b/Makefile index 6de731bd6..1f5aed156 100644 --- a/Makefile +++ b/Makefile @@ -401,6 +401,7 @@ lint: flake8 --config=scripts/flake8.cfg test/inhfd/*.py flake8 --config=scripts/flake8.cfg test/others/rpc/config_file.py flake8 --config=scripts/flake8.cfg lib/py/images/pb2dict.py + shellcheck --version shellcheck scripts/*.sh shellcheck scripts/ci/*.sh scripts/ci/apt-install shellcheck test/others/crit/*.sh diff --git a/scripts/ci/apt-install b/scripts/ci/apt-install index 0b5a6fe3f..5a790901a 100755 --- a/scripts/ci/apt-install +++ b/scripts/ci/apt-install @@ -12,7 +12,7 @@ max_apt_retries=5 # hashsum mismatches, DNS errors and similar things while true; do (( install_retry_counter+=1 )) - if [ ${install_retry_counter} -gt ${max_apt_retries} ]; then + if [ "${install_retry_counter}" -gt "${max_apt_retries}" ]; then exit 1 fi # shellcheck disable=SC2068 @@ -20,5 +20,5 @@ while true; do # In case it is a network error let's wait a bit. echo "Retrying attempt ${install_retry_counter}" - sleep ${install_retry_counter} + sleep "${install_retry_counter}" done diff --git a/scripts/systemd-autofs-restart.sh b/scripts/systemd-autofs-restart.sh index 65481b551..4d2be1c10 100755 --- a/scripts/systemd-autofs-restart.sh +++ b/scripts/systemd-autofs-restart.sh @@ -45,8 +45,8 @@ bindmount="" function remove_bindmount { if [ -n "$bindmount" ]; then - $JOIN_CT umount $bindmount - $JOIN_CT rm -rf $bindmount + $JOIN_CT umount "$bindmount" + $JOIN_CT rm -rf "$bindmount" bindmount="" fi } @@ -107,7 +107,7 @@ function save_mountpoint { # Nothing to do, if no file system is on top of autofs [ "$top_mount_fs_type" = "autofs" ] && return - bindmount=$($JOIN_CT mktemp -d) + bindmount="$($JOIN_CT mktemp -d)" if [ -z "$bindmount" ]; then echo "Failed to create temporary directory" return 1 diff --git a/scripts/tmp-files.sh b/scripts/tmp-files.sh index 33be4dafa..78edd9a9e 100755 --- a/scripts/tmp-files.sh +++ b/scripts/tmp-files.sh @@ -26,7 +26,7 @@ IMGFILE=$CRTOOLS_IMAGE_DIR"/tmpfiles.tar.gz" MY_NAME=$(basename "$0") case "$CRTOOLS_SCRIPT_ACTION" in - $POSTDUMP ) + "$POSTDUMP") if [ "$#" -lt 1 ]; then echo "$MY_NAME: ERROR! No files are given." exit 1 @@ -34,7 +34,7 @@ case "$CRTOOLS_SCRIPT_ACTION" in tar "$DUMPARGS" "$IMGFILE" -- "$@" exit $? ;; - $PRERESTORE ) + "$PRERESTORE") if [ "$#" -ne 0 ]; then echo "$MY_NAME: ERROR! Not expected script args." exit 1