forked from linkerd/linkerd2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helm
executable file
·39 lines (34 loc) · 927 Bytes
/
helm
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
#!/usr/bin/env sh
set -eu
if command -v helm >/dev/null ; then
exec helm "$@"
fi
helmversion=v3.9.1
bindir=$( cd "${0%/*}" && pwd )
targetbin=$( cd "$bindir"/.. && pwd )/target/bin
helmbin=$targetbin/helm-$helmversion
if [ ! -f "$helmbin" ]; then
if [ "$(uname -s)" = Darwin ]; then
os=darwin
arch=amd64
else
os=linux
case $(uname -m) in
x86_64) arch=amd64 ;;
arm) dpkg --print-architecture | grep -q arm64 && arch=arm64 || arch=arm ;;
esac
fi
helmcurl="https://get.helm.sh/helm-$helmversion-$os-$arch.tar.gz"
targetdir=$os-$arch
tmp=$(mktemp -d -t helm.XXX)
mkdir -p "$targetbin"
(
cd "$tmp"
"$bindir"/scurl -o "./helm.tar.gz" "$helmcurl"
tar zf "./helm.tar.gz" -x "$targetdir"
chmod +x "$targetdir/helm"
)
mv "$tmp/$targetdir/helm" "$helmbin"
rm -rf "$tmp"
fi
"$helmbin" "$@"