Skip to content

Commit

Permalink
Run different hash commands depending on the OS.
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtyhabits97 committed Sep 14, 2021
1 parent d111764 commit a38e8fa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ext/swiftlint/downloadSwiftlint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ do
shift
done

# If macOS
if [[ "$OSTYPE" == "darwin"* ]]; then
hash_cmd="md5"
# Default to linux
else
hash_cmd="md5sum"
fi

### Download
mkdir -p "${destination}"
curl -s -L "${url}" -o "${asset}"
if [[ ! -z "${SWIFTLINT_VERSION}" || $(md5 -q "${asset}") == "${default_hash}" ]]; then
if [[ ! -z "${SWIFTLINT_VERSION}" || $("$hash_cmd" -q "${asset}") == "${default_hash}" ]]; then
# if another version is set || our hardcoded hash is correct
unzip -o -q "${asset}" -d "${destination}"
else
Expand Down

0 comments on commit a38e8fa

Please sign in to comment.