forked from rancher/helm-unittest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-plugin.sh
executable file
·35 lines (28 loc) · 1.2 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
#!/bin/sh -e
# Copied w/ love from the excellent hypnoglow/helm-s3
if [ -n "${HELM_PUSH_PLUGIN_NO_INSTALL_HOOK}" ]; then
echo "Development mode: not downloading versioned release."
exit 0
fi
version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
echo "Downloading and installing helm-snapshot v${version} ..."
url=""
if [ "$(uname)" = "Darwin" ]; then
url="https://github.com/bdun1013/helm-snapshot/releases/download/v${version}/helm-snapshot_${version}_darwin_amd64.tar.gz"
elif [ "$(uname)" = "Linux" ] ; then
url="https://github.com/bdun1013/helm-snapshot/releases/download/v${version}/helm-snapshot_${version}_linux_amd64.tar.gz"
else
url="https://github.com/bdun1013/helm-snapshot/releases/download/v${version}/helm-snapshot_${version}_windows_amd64.tar.gz"
fi
echo $url
mkdir -p "bin"
mkdir -p "releases/v${version}"
# Download with curl if possible.
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}/snapshot" "bin/snapshot" || \
mv "releases/v${version}/snapshot.exe" "bin/snapshot"