diff --git a/bin/common.sh b/bin/common.sh index 6d2d102..72281ee 100755 --- a/bin/common.sh +++ b/bin/common.sh @@ -29,5 +29,20 @@ install_tool() { } install_tools() { - install_tool "${JQ_BIN}" "${JQ_VERSION}" "https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64" + os="" + case "$OSTYPE" in + darwin*) os="macos" ;; + linux*) os="linux" ;; + *) echo "unsupported OS: $OSTYPE"; exit ;; + esac + + arch="" + case "$(uname -m)" in + x86_64) arch="amd64" ;; + arm*) arch="arm64" ;; + aarch*) arch="arm64" ;; + *) echo "unsupported architecture: $(uname -m)"; exit ;; + esac + + install_tool "${JQ_BIN}" "${JQ_VERSION}" "https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-${os}-${arch}" }