-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdl-checksum.sh
executable file
·44 lines (38 loc) · 1.12 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
44
#!/usr/bin/env sh
set -e
DIR=~/Downloads
MIRROR=https://github.com/argoproj/argo-cd/releases/download
APP=argocd
dl()
{
local lchecksums=$1
local ver=$2
local os=$3
local arch=$4
local dotexe=${5:-}
local platform="$os-$arch"
local file="${APP}-${platform}${dotexe}"
local url="${MIRROR}/${ver}/${file}"
printf " # %s\n" $url
printf " %s: sha256:%s\n" $platform $(grep $file $lchecksums | awk '{print $1}')
}
dlver () {
local ver=$1
# https://github.com/argoproj/argo-cd/releases/download/v2.13.3/cli_checksums.txt
local checksums_url="${MIRROR}/${ver}/cli_checksums.txt"
local lchecksums="${DIR}/argocd_${ver}_checksums.txt"
if [ ! -e "${lchecksums}" ];
then
curl -sSLf -o "${lchecksums}" "${checksums_url}"
fi
printf " # %s\n" $checksums_url
printf " %s:\n" $ver
dl $lchecksums $ver linux amd64
dl $lchecksums $ver linux arm64
dl $lchecksums $ver linux ppc64le
dl $lchecksums $ver linux s390x
dl $lchecksums $ver darwin amd64
dl $lchecksums $ver darwin arm64
dl $lchecksums $ver windows amd64 .exe
}
dlver ${1:-v2.13.3}