From 9ea32345825969becf41b2e1bfadc9f16436c915 Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Mon, 16 Dec 2024 16:33:54 -0800 Subject: [PATCH] use sha256 to verify --- dev-infrastructure/scripts/istio.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/dev-infrastructure/scripts/istio.sh b/dev-infrastructure/scripts/istio.sh index 07177e293..41d55fe3c 100755 --- a/dev-infrastructure/scripts/istio.sh +++ b/dev-infrastructure/scripts/istio.sh @@ -11,7 +11,26 @@ if [[ -z "$TARGET_VERSION" ]]; then fi echo "********** Download istioctl**************" -curl -L "{$ISTIOCTL_URL}" | ISTIO_VERSION="${ISTIOCTL_VERSION}" TARGET_ARCH=x86_64 sh - +ISTIO_URL="https://github.com/istio/istio/releases/download/${ISTIOCTL_VERSION}/istio-${ISTIOCTL_VERSION}-linux-amd64.tar.gz" +SHA256_URL="https://github.com/istio/istio/releases/download/${ISTIOCTL_VERSION}/istio-${ISTIOCTL_VERSION}-linux-amd64.tar.gz.sha256" +# Download the Istioctl binary +wget $ISTIO_URL -O istio-"${ISTIOCTL_VERSION}"-linux-amd64.tar.gz + +# Download the SHA-256 checksum file +wget $SHA256_URL -O istio-"${ISTIOCTL_VERSION}"-linux-amd64.tar.gz.sha256 + +# Verify the downloaded file +sha256sum -c istio-"${ISTIOCTL_VERSION}"-linux-amd64.tar.gz.sha256 + +# Check the result of the verification +if [ $? -eq 0 ]; then + echo "Verification successful: The file is intact." +else + echo "Verification failed: The file is corrupted." + exit 1 +fi + +# curl -L "{$ISTIOCTL_URL}" | ISTIO_VERSION="${ISTIOCTL_VERSION}" TARGET_ARCH=x86_64 sh - cd istio-"${ISTIOCTL_VERSION}" export PATH=$PWD/bin:$PATH echo "=========================================================================="