From a1903d2644ceddc68077e0608e448afa7e514a5b Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 1 Apr 2021 14:28:41 +1300 Subject: [PATCH] Remove usage of local from fetch-params.sh --- test/lint/lint-shell.sh | 1 - zcutil/fetch-params.sh | 49 ++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/test/lint/lint-shell.sh b/test/lint/lint-shell.sh index 833e4cfcc..00523f66e 100755 --- a/test/lint/lint-shell.sh +++ b/test/lint/lint-shell.sh @@ -30,7 +30,6 @@ disabled=( SC2006 # Use $(..) instead of legacy `..`. SC2016 # Expressions don't expand in single quotes, use double quotes for that. SC2028 # echo won't expand escape sequences. Consider printf. - SC2039 # In POSIX sh, 'local' is undefined. SC2046 # Quote this to prevent word splitting. SC2048 # Use "$@" (with quotes) to prevent whitespace problems. SC2066 # Since you double quoted this, it will not word split, and the loop will only run once. diff --git a/zcutil/fetch-params.sh b/zcutil/fetch-params.sh index 9d776787d..69d2e964d 100755 --- a/zcutil/fetch-params.sh +++ b/zcutil/fetch-params.sh @@ -32,25 +32,24 @@ ZC_DISABLE_WGET="${ZC_DISABLE_WGET:-}" ZC_DISABLE_IPFS="${ZC_DISABLE_IPFS:-}" ZC_DISABLE_CURL="${ZC_DISABLE_CURL:-}" +LOCKFILE=/tmp/fetch_params.lock + fetch_wget() { if [ -z "$WGETCMD" ] || ! [ -z "$ZC_DISABLE_WGET" ]; then return 1 fi - local filename="$1" - local dlname="$2" - cat <$lockfile" + eval "exec 9>$LOCKFILE" # acquire the lock flock -n 9 \ && return 0 \ @@ -234,5 +233,5 @@ then fi main -rm -f /tmp/fetch_params.lock +rm -f $LOCKFILE exit 0