Verify checksum of s3deploy tool (#2596)

pull/2604/head
pierwill 2021-05-25 16:05:09 -05:00 committed by GitHub
parent 10f00e199b
commit c62b83034c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 6 deletions

View File

@ -1,11 +1,20 @@
S3DEPLOY_DOWNLOAD=s3deploy_${S3DEPLOY_VERSION}_Linux-64bit.tar.gz
set -x
set -e
S3DEPLOY_DOWNLOAD=s3deploy_${S3DEPLOY_VERSION}_Linux-64bit.tar.gz
S3DEPLOY_HASH=$(
# Download the checksums file from https://github.com/bep/s3deploy/releases
# and grep for the Linux-64bit.tar.gz hash.
curl -sL https://github.com/bep/s3deploy/releases/download/v${S3DEPLOY_VERSION}/s3deploy_${S3DEPLOY_VERSION}_checksums.txt \
| grep "Linux-64bit.tar.gz" | cut -f 1 -d" " | tr -d "\n"
)
# Install s3deploy if not already cached or upgrade an old version.
if [ ! -e $HOME/bin/s3deploy ] || ! [[ `$HOME/bin/s3deploy -V` =~ ${S3DEPLOY_VERSION} ]]; then
# Download and verify checksum
wget https://github.com/bep/s3deploy/releases/download/v${S3DEPLOY_VERSION}/${S3DEPLOY_DOWNLOAD}
echo "$S3DEPLOY_HASH $S3DEPLOY_DOWNLOAD" | sha256sum --check -
tar xvzf ${S3DEPLOY_DOWNLOAD} s3deploy
mv s3deploy $HOME/bin/s3deploy
fi