-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
50 lines (37 loc) · 1.12 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
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
echo " ___ _____ _ ___ ___ "
echo "/ __|_ _/_\ / __/ __|"
echo "\__ \ | |/ _ \ (_| (__ "
echo "|___/ |_/_/ \_\___\___|"
echo ""
if [[ ! ":$PATH:" == *":/usr/local/bin:"* ]]; then
echo "Your path is missing /usr/local/bin, you need to add this to use this installer."
exit 1
fi
if [ "$(uname)" == "Darwin" ]; then
OS=darwin
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
OS=linux
else
echo "This installer is only supported on Linux and MacOS"
exit 1
fi
ARCH="\$(uname -m)"
VERSION=$(curl -L --silent "https://api.github.com/repos/stacc/cli/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
URL="https://github.com/stacc/cli/releases/download/$VERSION/stacc_${VERSION:1}_$(uname)_$(uname -m).tar.gz"
echo "- Downloading from $URL"
if [ $(command -v curl) ]; then
curl -LSs "$URL" | tar xz
else
wget -O- "$URL" | tar xz
fi
if [ $? -ne 0 ]; then
echo "Failed to download from $URL"
exit 1
fi
TARGET="/usr/local/bin/stacc"
echo "- Installing binary to $TARGET"
sudo mv "stacc" "$TARGET"
LOCATION=$(command -v stacc)
echo ""
echo "Stacc CLI has been successfully installed!"