From ff1a30457ba8834c258dee8de6b770921e3d4fa1 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:54:34 -0600 Subject: [PATCH 01/13] Update generateForDay.sh: fix SC2086 --- scripts/generateForDay.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/generateForDay.sh b/scripts/generateForDay.sh index 4eae661f7..ebfcaea63 100755 --- a/scripts/generateForDay.sh +++ b/scripts/generateForDay.sh @@ -183,14 +183,14 @@ if [[ ${TYPE} == "GENERATE" ]]; then [[ -n ${DEBUG_ARG} ]] && echo "${ME}: Executing: ${CMD}" # shellcheck disable=SC2086 eval ${CMD} - RET=$? + local RET=$? if [[ ${RET} -ne 0 ]]; then echo -e "${RED}${ME}: Command Failed: ${CMD}${NC}" elif [[ ${SILENT} == "false" ]]; then echo -e "\tDone" fi - return ${RET} + return "${RET}" } else From 72d5f33815fbd3ba8ba46a3bf005dc83f4855361 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:57:04 -0600 Subject: [PATCH 02/13] Update postData.sh: SC2086 fix --- scripts/postData.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/postData.sh b/scripts/postData.sh index a6274ae6e..62ae3a110 100755 --- a/scripts/postData.sh +++ b/scripts/postData.sh @@ -83,7 +83,7 @@ while [[ $# -gt 0 ]]; do esac shift done -[[ ${RET} -ne 0 ]] && usage_and_exit ${RET} +[[ ${RET} -ne 0 ]] && usage_and_exit "${RET}" [[ ${HELP} == "true" ]] && usage_and_exit 0 From b5c1bcd612a44f3e3e7824ef183f49135c73d612 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:58:00 -0600 Subject: [PATCH 03/13] Update checkAllsky.sh: fix SC2086 --- scripts/checkAllsky.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkAllsky.sh b/scripts/checkAllsky.sh index b870c711c..a78f0b3a9 100755 --- a/scripts/checkAllsky.sh +++ b/scripts/checkAllsky.sh @@ -868,4 +868,4 @@ else fi fi -exit ${RET} +exit "${RET}" From 1a8e21b4a0b0cd8a75233b8987d11dde10a61d30 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:00:30 -0600 Subject: [PATCH 04/13] Update postToMap.sh: SC2086 fix --- scripts/postToMap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/postToMap.sh b/scripts/postToMap.sh index e33a5cc54..325d38608 100755 --- a/scripts/postToMap.sh +++ b/scripts/postToMap.sh @@ -73,7 +73,7 @@ function check_URL() else # Make sure it's a valid URL. Some servers don't return anything if the user agent is "curl". - local CONTENT="$( curl --user-agent Allsky --location --head --silent --show-error --connect-timeout ${TIMEOUT} "${URL}" 2>&1 )" + local CONTENT="$( curl --user-agent Allsky --location --head --silent --show-error --connect-timeout "${TIMEOUT}" "${URL}" 2>&1 )" local RET=$? if [[ ${DEBUG} == "true" ]]; then echo -e "\n${wDEBUG}" @@ -356,7 +356,7 @@ if [[ ${UPLOAD} == "true" ]]; then else echo -e "${ERROR_MSG_START}${E}${wNC}" fi - exit ${RETURN_CODE} + exit "${RETURN_CODE}" fi # Get the return string from the server. It's the last line of output. From e87e8879ce59920c15301b6f3cc0d79bef658fd9 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:01:32 -0600 Subject: [PATCH 05/13] Update testUpload.sh: SC2086 fix --- scripts/testUpload.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testUpload.sh b/scripts/testUpload.sh index b3965994d..9e1fc38e0 100755 --- a/scripts/testUpload.sh +++ b/scripts/testUpload.sh @@ -302,4 +302,4 @@ if [[ -s ${MSG_FILE} ]]; then fi rm -f "${MSG_FILE}" -exit ${RET} +exit "${RET}" From 1f2f57991b413f3781a8c5d2e755d152143ea12b Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:08:09 -0600 Subject: [PATCH 06/13] Update installUpgradeFunctions.sh: SC2086 fixes --- scripts/installUpgradeFunctions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh index 6cbe32c74..d7581df40 100644 --- a/scripts/installUpgradeFunctions.sh +++ b/scripts/installUpgradeFunctions.sh @@ -605,9 +605,9 @@ function replace_website_placeholders() config.camera "camera" "${CAMERA}" \ config.lens "lens" "${LENS}" \ config.computer "computer" "${COMPUTER}" \ - config.AllskyVersion "AllskyVersion" "${ALLSKY_VERSION}" \ - ${MINI_TLAPSE_DISPLAY} "mini_display" "${MINI_TLAPSE_DISPLAY_VALUE}" \ - ${MINI_TLAPSE_URL} "mini_url" "${MINI_TLAPSE_URL_VALUE}" + "${WEBSITE_ALLSKY_VERSION}" "AllskyVersion" "${ALLSKY_VERSION}" \ + "${MINI_TLAPSE_DISPLAY}" "mini_display" "${MINI_TLAPSE_DISPLAY_VALUE}" \ + "${MINI_TLAPSE_URL}" "mini_url" "${MINI_TLAPSE_URL_VALUE}" } From 91e6129ac9b67dac90dd24c8bbcfacad46de9a6c Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:10:01 -0600 Subject: [PATCH 07/13] Update saveImage.sh: SC2086 fix --- scripts/saveImage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/saveImage.sh b/scripts/saveImage.sh index 6b04b9557..f39025fe0 100755 --- a/scripts/saveImage.sh +++ b/scripts/saveImage.sh @@ -363,7 +363,7 @@ if [[ ${SAVE_IMAGE} == "true" ]]; then # Remove the oldest files if we haven't reached the limit. if [[ ${LEFT} -le 0 ]]; then KEEP=$((TIMELAPSE_MINI_IMAGES - TIMELAPSE_MINI_FREQUENCY)) - x="$( tail -${KEEP} "${MINI_TIMELAPSE_FILES}" )" + x="$( tail "-${KEEP}" "${MINI_TIMELAPSE_FILES}" )" echo -e "${x}" > "${MINI_TIMELAPSE_FILES}" if [[ ${ALLSKY_DEBUG_LEVEL} -ge 3 ]]; then echo -en "${YELLOW}${ME}: Replaced ${TIMELAPSE_MINI_FREQUENCY} oldest, LEFT=$LEFT, KEEP=$KEEP" From bbc5b888513bb4d776c43dd2d3e3457d534cd443 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:12:26 -0600 Subject: [PATCH 08/13] Update remoteWebsiteInstall.sh: SC2086 fixes --- remoteWebsiteInstall.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 23e710221..660afd36d 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -104,7 +104,7 @@ function enter_yes_no() fi done - return ${RESULT} + return "${RESULT}" } # prompt the user to press any key. @@ -163,7 +163,7 @@ function display_box() else echo -e "${DIALOG_TEXT}" fi - return ${RET} + return "${RET}" fi # Don't use: it's redundant most of the time --backtitle "${DIALOG_BACK_TITLE}" \ @@ -593,7 +593,7 @@ function check_if_files_exist() fi done - return ${RET_CODE} + return "${RET_CODE}" } # Deletes a file from the remote server. From e2d2787c789c1910b72bd051e6020b9f140ca93a Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:16:03 -0600 Subject: [PATCH 09/13] Update ci_shellcheck.yml: update "paths" --- .github/workflows/ci_shellcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_shellcheck.yml b/.github/workflows/ci_shellcheck.yml index 17a21cf5c..f0e58657a 100644 --- a/.github/workflows/ci_shellcheck.yml +++ b/.github/workflows/ci_shellcheck.yml @@ -7,8 +7,8 @@ on: push: paths: - '*.sh' - - '*/*.sh' - - '*/*/*.sh' + - 'scripts/*.sh' + - 'scripts/utilities/*.sh' # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: From 6308d0f21af288a68246b1b8bf8e91da1680c96b Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:20:51 -0600 Subject: [PATCH 10/13] Update ci_shellcheck.yml: go 3 levels --- .github/workflows/ci_shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_shellcheck.yml b/.github/workflows/ci_shellcheck.yml index f0e58657a..9eab4c9fb 100644 --- a/.github/workflows/ci_shellcheck.yml +++ b/.github/workflows/ci_shellcheck.yml @@ -27,7 +27,7 @@ jobs: run: | # check bash files (bash -n, shellcheck -x) err=0 - for i in $(find . -maxdepth 2 -name '*.sh'); do + for i in $(find . -maxdepth 3 -name '*.sh'); do echo "==================== $i" bash -n $i if [ $? -ne 0 ]; then From d9ea172b747937a6b1e8de5383e55b735b866d23 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:23:02 -0600 Subject: [PATCH 11/13] Update allsky-config.sh: SC2086 fix --- scripts/utilities/allsky-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utilities/allsky-config.sh b/scripts/utilities/allsky-config.sh index f102c7341..0aa76b5e1 100755 --- a/scripts/utilities/allsky-config.sh +++ b/scripts/utilities/allsky-config.sh @@ -268,7 +268,7 @@ function prompt() exit 2 else echo "${OPT}" - return ${RET} + return "${RET}" fi } From 27bdbf3641ee2d7f7480734ead5c048f3c038566 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:27:54 -0600 Subject: [PATCH 12/13] Update installSamba.sh: shellcheck fix --- scripts/utilities/installSamba.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/utilities/installSamba.sh b/scripts/utilities/installSamba.sh index ce8f82feb..3afdc87cd 100755 --- a/scripts/utilities/installSamba.sh +++ b/scripts/utilities/installSamba.sh @@ -75,6 +75,7 @@ echo echo -en "${BOLD}" echo "=============================================" echo -n "Press RETURN to continue with installation: " +# shellcheck disable=SC2034 read -r x echo -e "${NC}" From 8a3d5676d362d314b1f589a6711f93ba1a798b80 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:32:13 -0600 Subject: [PATCH 13/13] Update allsky-config.sh: shellcheck fixes --- scripts/utilities/allsky-config.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/utilities/allsky-config.sh b/scripts/utilities/allsky-config.sh index 0aa76b5e1..89574f55a 100755 --- a/scripts/utilities/allsky-config.sh +++ b/scripts/utilities/allsky-config.sh @@ -42,6 +42,7 @@ while [[ $# -gt 0 ]]; do *) CMD="${ARG}" shift + # shellcheck disable=SC2124 CMD_ARGS="${@}" break; ;; @@ -84,6 +85,7 @@ PATH="${PATH}:${ALLSKY_UTILITIES}" # Show all the supported cameras. function show_supported_cameras() { + # shellcheck disable=SC2124 local ARGS="${@}" #shellcheck disable=SC2086 @@ -98,7 +100,7 @@ function show_supported_cameras() ARGS="$( prompt "${PROMPT}" "${OPTS[@]}" )" fi - #shellcheck disable=SC2086 + # shellcheck disable=SC2086 show_supported_cameras.sh ${ARGS} } @@ -114,10 +116,13 @@ function show_connected_cameras() else local FORMAT="%-6s %-8s %s\n" echo + # shellcheck disable=SC2059 printf "${FORMAT}" "Type" "Number" "Model" + # shellcheck disable=SC2059 printf "${FORMAT}" "====" "======" "=====" echo -e "${CAMERAS}" | while read -r TYPE NUM MODEL do + # shellcheck disable=SC2059 printf "${FORMAT}" "${TYPE}" "${NUM}" "${MODEL}" done fi @@ -127,9 +132,10 @@ function show_connected_cameras() # Show all the currently connected cameras. function new_rpi_camera_info() { + # shellcheck disable=SC2124 local ARGS="${@}" # optional - #shellcheck disable=SC2086 + # shellcheck disable=SC2086 get_RPi_camera_info.sh ${ARGS} } @@ -232,6 +238,7 @@ function run_command() { COMMAND="${1}" shift + # shellcheck disable=SC2124 ARGUMENTS="${@}" if ! type "${COMMAND}" > /dev/null 2>&1 ; then echo -e "\n${RED}${ME}: Unknown command '${COMMAND}'.${NC}" >&2 @@ -294,7 +301,7 @@ if [[ -z ${CMD} ]]; then run_command "${COMMAND}" RET=$? - [[ ${ALLOW_MORE_COMMANDS} == "false" ]] && exit ${RET} + [[ ${ALLOW_MORE_COMMANDS} == "false" ]] && exit "${RET}" while true; do echo -e "\n\n" echo -e "${YELLOW}${BOLD}"