Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- latest_link="https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz"
- sig_link="https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz.sig"
- dest_dir="/usr/local/openjdk"
- jdk="/tmp/corretto-17.tgz"
- pub="/tmp/corretto.pub"
- sig="/tmp/corretto.sig"
- # tarball
- wget -qc ${latest_link} -O "${jdk}"
- # pub key - comment after import
- # wget https://corretto.aws/downloads/resources/17.0.0.35.1/B04F24E3.pub -O "$pub"
- # sig
- wget -qc ${sig_link} -O "${sig}"
- # verify
- gpg --verify "${sig}" "${jdk}" &>/dev/null || { echo "GPG verify returned an error for ${jdk} (maybe pub key not imported?)"; exit 1; }
- # remove old directory
- cd ${dest_dir} && find . -maxdepth 1 -type d -name 'amazon-corretto-17.*x64' -exec rm -rf '{}' \; || { echo "Error removing amazon-corretto directory. terminating."; exit 1; }
- # untar latest jdk
- tar xfz "${jdk}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement