Skip to content

Commit

Permalink
chore: Adapt url download url
Browse files Browse the repository at this point in the history
  • Loading branch information
qbart committed Sep 15, 2023
1 parent 2c43ed7 commit ee7e21d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ download_release() {
version="$1"
filename="$2"

# TODO: Adapt the release URL convention for cli
url="$GH_REPO/archive/v${version}.tar.gz"
# FIXED: Adapt the release URL convention for cli
local -r platform="$(get_platform)"
local -r arch="$(get_arch)"
url="$GH_REPO/releases/download/v${version}/cli_${version}_${platform}_${arch}.tar.gz"

echo "* Downloading $TOOL_NAME release $version..."
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
Expand Down Expand Up @@ -72,3 +74,16 @@ install_version() {
fail "An error occurred while installing $TOOL_NAME $version."
)
}

get_arch() {
local -r machine="$(uname -m)"
if [[ $machine == "arm64" ]] || [[ $machine == "aarch64" ]]; then
echo "arm64"
else
echo "amd64"
fi
}

get_platform() {
uname | tr '[:upper:]' '[:lower:]'
}

0 comments on commit ee7e21d

Please sign in to comment.