Skip to content

Commit

Permalink
add APR to updatecli checksum manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz committed Oct 29, 2024
1 parent aa0c4b6 commit 6790189
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion get-checksum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ case "$1" in
VERSION=$(jq -r '.tcnative_version' "tomcat${TOMCAT_MAJOR}.json")
SHA_URL="https://dlcdn.apache.org/tomcat/tomcat-connectors/native/${VERSION}/source/tomcat-native-${VERSION}-src.tar.gz.sha512"
;;
apr)
VERSION=$(jq -r '.apr_version' "tomcat${TOMCAT_MAJOR}.json")
SHA_URL="https://dlcdn.apache.org/apr/apr-${VERSION}.tar.gz.sha256"
;;
esac

SHA_LEN=$((${SHA_URL##*.sha} / 4))

CHECKSUM=$(curl -sLf "${SHA_URL}" | cut -d ' ' -f 1)
if [ ${#CHECKSUM} -eq 128 ]; then
if [ ${#CHECKSUM} -eq $SHA_LEN ]; then
echo "$CHECKSUM"
else
echo -n "ERROR Looks like checksum cannot be retrieved correctly from ${SHA_URL} - Actual contents: " >&2
Expand Down
19 changes: 17 additions & 2 deletions updatecli.d/02_tomcat_checksum.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,34 @@ sources:
environments:
- name: PATH
- name: TOMCAT_MAJOR
aprChecksum:
name: Retrieve the Apache APR libs checksum
kind: shell
spec:
command: ./get-checksum.sh apr
environments:
- name: PATH
- name: TOMCAT_MAJOR

targets:
tomcatJson:
name: Update version in json target
name: Update Tomcat checksum in json target
kind: json
sourceid: tomcatChecksum
spec:
file: tomcat{{ requiredEnv "TOMCAT_MAJOR" }}.json
key: tomcat_sha512
tcnativeJson:
name: Update version in json target
name: Update Tcnative libs checksum in json target
kind: json
sourceid: tcnativeChecksum
spec:
file: tomcat{{ requiredEnv "TOMCAT_MAJOR" }}.json
key: tcnative_sha512
aprJson:
name: Update APR checksum in json target
kind: json
sourceid: aprChecksum
spec:
file: tomcat{{ requiredEnv "TOMCAT_MAJOR" }}.json
key: apr_sha256

0 comments on commit 6790189

Please sign in to comment.