From bf843edb80b1cba9be30cd1c5221aebb24cb5a9f Mon Sep 17 00:00:00 2001 From: Mirco Date: Fri, 12 Apr 2024 14:54:17 +0200 Subject: [PATCH] refactoring image install.sh checksum function graalvm kubeconform --- infrastructure/clj/image/resources/install.sh | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/infrastructure/clj/image/resources/install.sh b/infrastructure/clj/image/resources/install.sh index e55ee24..a86e899 100755 --- a/infrastructure/clj/image/resources/install.sh +++ b/infrastructure/clj/image/resources/install.sh @@ -12,7 +12,7 @@ function main() { kubeconform_version="0.6.4" graalvm_jdk_version="21.0.2" - curl -SsLo /tmp/kubeconform.tar.gz https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/kubeconform-linux-amd64.tar.gz + curl -SsLo /tmp/kubeconform-linux-amd64.tar.gz https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/kubeconform-linux-amd64.tar.gz curl -SsLo /tmp/CHECKSUMS https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/CHECKSUMS curl -SsLo /tmp/graalvm-community-jdk.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz curl -SsLo /tmp/graalvm-checksum https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz.sha256 @@ -21,7 +21,7 @@ function main() { checksum # install kubeconform - tar -C /usr/local/bin -xf /tmp/kubeconform.tar.gz --exclude=LICENSE + tar -C /usr/local/bin -xf /tmp/kubeconform-linux-amd64.tar.gz --exclude=LICENSE # install graalvm tar -C /usr/lib/jvm/ -xf /tmp/graalvm-community-jdk.tar.gz @@ -44,17 +44,13 @@ function main() { } function checksum() { - checksum_kubeconform=$(awk '{print $1}' /tmp/CHECKSUMS|sed -n '2p') - sha256sum_kubeconform=$(sha256sum /tmp/kubeconform.tar.gz|awk '{print $1}') - checksum_graalvm_jdk=$(awk '{print $1}' /tmp/graalvm-checksum) - sha256sum_graalvm_jdk=$(sha256sum /tmp/graalvm-community-jdk.tar.gz|awk '{print $1}') - - if [ $checksum_kubeconform == $sha256sum_kubeconform -a $checksum_graalvm_jdk == $sha256sum_graalvm_jdk ]; then - echo "Kubeconform & graalvm_jdk checksum verification succesful" - else - echo "Failure in kubeconform|graalvm_jdk checksum verification" - exit 1 - fi + #kubeconform + awk '{print $1 " /tmp/" $2}' /tmp/CHECKSUMS|sed -n '2p' > /tmp/kubeconform-checksum + sha256sum -c --status /tmp/kubeconform-checksum + + #graalvm + echo " /tmp/graalvm-community-jdk.tar.gz"|tee -a /tmp/graalvm-checksum + sha256sum -c --status /tmp/graalvm-checksum } source /tmp/install_functions_debian.sh