forked from helm/helm-2to3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_plugin.sh
executable file
·47 lines (41 loc) · 1.69 KB
/
install_plugin.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
45
46
47
#!/bin/sh -e
if [ -n "${HELM_LINTER_PLUGIN_NO_INSTALL_HOOK}" ]; then
echo "Development mode: not downloading versioned release."
exit 0
fi
# shellcheck disable=SC2002
version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
echo "Downloading and installing helm-2to3 v${version} ..."
url=""
if [ "$(uname)" = "Darwin" ]; then
if [ "$(uname -m)" = "arm64" ]; then
url="https://github.com/helm/helm-2to3/releases/download/v${version}/helm-2to3_${version}_darwin_arm64.tar.gz"
else
url="https://github.com/helm/helm-2to3/releases/download/v${version}/helm-2to3_${version}_darwin_amd64.tar.gz"
fi
elif [ "$(uname)" = "Linux" ] ; then
if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then
url="https://github.com/helm/helm-2to3/releases/download/v${version}/helm-2to3_${version}_linux_arm64.tar.gz"
else
url="https://github.com/helm/helm-2to3/releases/download/v${version}/helm-2to3_${version}_linux_amd64.tar.gz"
fi
else
url="https://github.com/helm/helm-2to3/releases/download/v${version}/helm-2to3_${version}_windows_amd64.tar.gz"
fi
echo "$url"
mkdir -p "bin"
mkdir -p "releases/v${version}"
# Download with curl if possible.
# shellcheck disable=SC2230
if [ -x "$(which curl 2>/dev/null)" ]; then
curl -sSL "${url}" -o "releases/v${version}.tar.gz"
else
wget -q "${url}" -O "releases/v${version}.tar.gz"
fi
tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}"
mv "releases/v${version}/2to3" "bin/2to3" || \
mv "releases/v${version}/2to3.exe" "bin/2to3"
mv "releases/v${version}/plugin.complete" .
mv "releases/v${version}/plugin.yaml" .
mv "releases/v${version}/README.md" .
mv "releases/v${version}/LICENSE" .