diff --git a/bin/download b/bin/download index 6223f62..b8059a8 100755 --- a/bin/download +++ b/bin/download @@ -5,17 +5,17 @@ set -euo pipefail # Determine the platform and architecture dynamically platform="$(uname)" case "${platform}" in -"Linux") platform="Linux" ;; -"Darwin") platform="Darwin" ;; -*) fail "Unsupported platform: ${platform}" ;; + "Linux") platform="Linux" ;; + "Darwin") platform="Darwin" ;; + *) fail "Unsupported platform: ${platform}" ;; esac architecture="$(uname -m)" case "${architecture}" in -"x86_64") architecture="x86_64" ;; -"arm64" | "aarch64") architecture="arm64" ;; -"i386") architecture="i386" ;; -*) fail "Unsupported architecture: ${architecture}" ;; + "x86_64") architecture="x86_64" ;; + "arm64"|"aarch64") architecture="arm64" ;; + "i386") architecture="i386" ;; + *) fail "Unsupported architecture: ${architecture}" ;; esac current_script_path=${BASH_SOURCE[0]} @@ -27,13 +27,14 @@ source "${plugin_dir}/lib/utils.bash" mkdir -p "$ASDF_DOWNLOAD_PATH" # Set the release file based on the dynamic platform, architecture, and version. -release_file="$ASDF_DOWNLOAD_PATH/${TOOL_NAME}_${ASDF_INSTALL_VERSION}_${platform}_${architecture}.tar.gz" +release_file="overmind_cli_${ASDF_INSTALL_VERSION}_${platform}_${architecture}.tar.gz" +download_path="$ASDF_DOWNLOAD_PATH/$release_file" # Download tar.gz file to the download directory -download_release "$ASDF_INSTALL_VERSION" "$release_file" +download_release "$ASDF_INSTALL_VERSION" "$release_file" "$download_path" # Extract contents of tar.gz file into the download directory -tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file" +tar -xzf "$download_path" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $download_path" # Remove the tar.gz file since we don't need to keep it -rm "$release_file" +rm "$download_path" \ No newline at end of file diff --git a/lib/utils.bash b/lib/utils.bash index 9ee0d68..d2a65e7 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -34,15 +34,16 @@ list_all_versions() { } download_release() { - local version filename url + local version filename download_path url version="$1" filename="$2" + download_path="$3" # Construct the dynamic URL based on the provided version, platform, and architecture. url="$GH_REPO/releases/download/v${version}/${filename}" echo "* Downloading $TOOL_NAME release $version..." - curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url" + curl "${curl_opts[@]}" -o "$download_path" -C - "$url" || fail "Could not download $url" } install_version() {