Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ mkdir -p "$ASDF_DOWNLOAD_PATH"
# TODO: Adapt this to proper extension and adapt extracting strategy.
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"

fips_build=false
if [[ "$ASDF_INSTALL_VERSION" == *-fips ]]; then
ASDF_INSTALL_VERSION="${ASDF_INSTALL_VERSION%-fips}"
fips_build=true
fi

# Download tar.gz file to the download directory
download_release "$ASDF_INSTALL_VERSION" "$release_file"
download_release "$ASDF_INSTALL_VERSION" "$release_file" "$fips_build"

# 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"
Expand Down
12 changes: 9 additions & 3 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,20 @@ detect_arch() {
}

download_release() {
local version filename url
local version filename url fips
version="$1"
filename="$2"
fips_build="$3"
os=$(detect_os)
arch=$(detect_arch "$os")
url="$REPO/teleport-ent-v${version}-${os}-${arch}-bin.tar.gz"

echo "* Downloading $TOOL_NAME release $version..."
if [[ "$fips_build" == true ]]; then
url="$REPO/teleport-ent-v${version}-${os}-${arch}-fips-bin.tar.gz"
else
url="$REPO/teleport-ent-v${version}-${os}-${arch}-bin.tar.gz"
fi

echo "* Downloading $TOOL_NAME release $version (fips=$fips_build)..."
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
}

Expand Down