Advertisement
Guest User

Amazon Corretto cron job

a guest
Dec 27th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. latest_link="https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz"
  4. sig_link="https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz.sig"
  5. dest_dir="/usr/local/openjdk"
  6. jdk="/tmp/corretto-17.tgz"
  7. pub="/tmp/corretto.pub"
  8. sig="/tmp/corretto.sig"
  9.  
  10. # tarball
  11. wget -qc ${latest_link} -O "${jdk}"
  12.  
  13. # pub key - comment after import
  14. # wget https://corretto.aws/downloads/resources/17.0.0.35.1/B04F24E3.pub -O "$pub"
  15.  
  16. # sig
  17. wget -qc ${sig_link} -O "${sig}"
  18.  
  19. # verify
  20. gpg --verify "${sig}" "${jdk}" &>/dev/null || { echo "GPG verify returned an error for ${jdk} (maybe pub key not imported?)"; exit 1; }
  21.  
  22. # remove old directory
  23. 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; }
  24.  
  25. # untar latest jdk
  26. tar xfz "${jdk}"
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement