Skip to content

Commit

Permalink
feat(maven): support checksum install (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chumper authored Feb 26, 2023
1 parent 1c0ec9f commit 7df5634
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/usr/local/buildpack/tools/v2/maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ function install_tool () {
versioned_tool_path=$(create_versioned_tool_path)

local file
local URL='https://downloads.apache.org'

# https://downloads.apache.org/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
file=$(get_from_url "${URL}/${TOOL_NAME}/${TOOL_NAME}-${MAJOR}/${TOOL_VERSION}/binaries/apache-${TOOL_NAME}-${TOOL_VERSION}-bin.tar.gz")
local URL='https://downloads.apache.org'
local file_name="apache-${TOOL_NAME}-${TOOL_VERSION}-bin.tar.gz"
local file_url="${TOOL_NAME}/${TOOL_NAME}-${MAJOR}/${TOOL_VERSION}/binaries/${file_name}"

checksum_file=$(get_from_url "${URL}/${file_url}.sha512")
# get checksum from file
original_checksum=$(cat "${checksum_file}")

file=$(get_from_url \
"${URL}/${file_url}" \
"${file_name}" \
"${original_checksum}" \
"sha512sum" )
tar --strip 1 -C "${versioned_tool_path}" -xf "${file}"
}

Expand Down

0 comments on commit 7df5634

Please sign in to comment.