forked from bmatcuk/helm-take-ownership
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·39 lines (32 loc) · 1.02 KB
/
install.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
#!/usr/bin/env bash
# some ideas borrowed from: https://github.com/nouney/helm-gcs/blob/0.1.1/install.sh
if type "curl" >/dev/null 2>&1; then
GET_LATEST="curl -s"
DOWNLOAD="curl -sSLO"
elif type "wget" >/dev/null 2>&1; then
GET_LATEST="wget -q -O -"
DOWNLOAD="wget -q"
else
echo "curl or wget are required to install!"
exit 1
fi
fail_trap() {
result=$?
if [ "$result" != "0" ]; then
echo "Failed to install helm-take-ownership"
echo "\tSee https://github.com/bmatcuk/helm-take-ownership"
fi
exit $result
}
trap "fail_trap" EXIT
set -e
os=`uname -s`
arch=`uname -m`
url=`$GET_LATEST https://api.github.com/repos/bmatcuk/helm-take-ownership/releases/latest | awk '/browser_download_url/ { print $2 }' | sed 's/"//g' | grep ${os}_${arch}`
filename=`echo $url | rev | cut -d '/' -f 1 | rev`
echo "* Downloading $url"
$DOWNLOAD $url
echo "* Extracting $filename"
rm -rf bin && mkdir bin && tar xzvf $filename -C bin >/dev/null && rm -f $filename
echo "* helm-take-ownership installed!"
bin/helm-take-ownership --help