-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdl-checksum.sh
executable file
·43 lines (38 loc) · 1.18 KB
/
dl-checksum.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env sh
set -e
DIR=~/Downloads
MIRROR=https://github.com/argoproj/argo-workflows/releases/download
# https://github.com/argoproj/argo-workflows/releases/download/v3.4.4/argo-linux-amd64.gz
# https://github.com/argoproj/argo-workflows/releases/download/v3.4.4/argo-workflows-cli-checksums.txt
dl()
{
local lsums=$1
local ver=$2
local os=$3
local arch=$4
local suffix=${5:-gz}
local platform="$os-$arch"
local exe="argo-${platform}.${suffix}"
local url="${MIRROR}/v${ver}/${exe}"
printf " # %s\n" $url
printf " %s: sha256:%s\n" $platform $(grep "${exe}" "${lsums}" | awk '{ print $1 }')
}
dlver () {
local ver=$1
local lsums="${DIR}/argo-workflows-${ver}-cli-checksums.txt"
local rsums="${MIRROR}/v${ver}/argo-workflows-cli-checksums.txt"
if [ ! -e "${csums}" ];
then
curl -sSLf -o "${lsums}" "${rsums}"
fi
printf " # %s\n" $rsums
printf " '%s':\n" $ver
dl $lsums $ver darwin amd64
dl $lsums $ver darwin arm64
dl $lsums $ver linux amd64
dl $lsums $ver linux arm64
dl $lsums $ver linux ppc64le
dl $lsums $ver linux s390x
dl $lsums $ver windows amd64 exe.gz
}
dlver ${1:-3.6.0}