diff --git a/ext/swiftlint/downloadSwiftlint.sh b/ext/swiftlint/downloadSwiftlint.sh index a92769c..f78c159 100755 --- a/ext/swiftlint/downloadSwiftlint.sh +++ b/ext/swiftlint/downloadSwiftlint.sh @@ -31,21 +31,19 @@ do shift done -set -x - -### Download -mkdir -p "${destination}" -curl -s -L "${url}" -o "${asset}" - # If macOS if [[ "$OSTYPE" == "darwin"* ]]; then - resulting_hash=`md5 -q ${asset}` + hash_cmd="md5 -q ${asset}" # Default to linux else - resulting_hash=`md5sum ${asset} | awk '{ print $1 }'` + hash_cmd="md5sum ${asset} | awk '{ print $1 }'" fi -if [[ ! -z "${SWIFTLINT_VERSION}" || "$resulting_hash" == "${default_hash}" ]]; then +### Download +mkdir -p "${destination}" +curl -s -L "${url}" -o "${asset}" + +if [[ ! -z "${SWIFTLINT_VERSION}" || `$hash_cmd` == "${default_hash}" ]]; then # if another version is set || our hardcoded hash is correct unzip -o -q "${asset}" -d "${destination}" else