Skip to content

Instantly share code, notes, and snippets.

@dblevins
Created Apr 7, 2021
Embed
What would you like to do?
Verify an Apache TomEE binary
#!/bin/bash
FILE="${1?Specify a TomEE zip, war or tar.gz to verify}"
SHA="$FILE.sha512"
[ -f "$SHA" ] || {
echo "Downloading sha512 for $FILE"
BIN="$(basename "$FILE")"
VER="$(echo "$BIN" | perl -pe 's,apache-(tomee-.*?)-[a-z]+\.(zip|tar.gz|war),$1,')"
curl -s "https://downloads.apache.org/tomee/$VER/$BIN.sha512" > "$SHA"
}
echo "$(cat $SHA) $FILE" | sha512sum -c - || {
echo "SHA-512 check failed: $FILE"
exit 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment