-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall.sh
executable file
·29 lines (24 loc) · 926 Bytes
/
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
#!/bin/bash
# USAGE: ./install.sh [version]
# will install the latest tool executable to your /usr/local/bin
set -e
echo "Installing..."
TMPDIR=${TMPDIR:-"/tmp"}
pushd "$TMPDIR" > /dev/null
mkdir -p kubescout
pushd kubescout > /dev/null;
distro=$(if [[ "$(uname -s)" == "Darwin" ]]; then echo "osx"; else echo "linux"; fi)
if [ -n "$1" ]
then
echo "Will download and install v$1"
curl -sSL --fail -o kubescout.zip "https://github.com/reallyliri/kubescout/releases/download/v$1/kubescout-$distro.zip"
else
curl -s --fail https://api.github.com/repos/reallyliri/kubescout/releases/latest | grep "browser_download_url.*$distro.zip" | cut -d : -f 2,3 | tr -d \" | xargs curl -sSL --fail -o kubescout.zip
fi
unzip kubescout.zip
chmod +x kubescout
cp -f kubescout /usr/local/bin/kubescout
popd > /dev/null
rm -rf kubescout
popd > /dev/null
echo "Done: $(kubescout -v)"