-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
51 lines (38 loc) · 1.25 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
51
#!/bin/bash
echo " _ _ "
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/blocc-cli-releases/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
URL="https://github.com/stacc/blocc-cli-releases/releases/download/$VERSION/blocc_${VERSION:1}_$(uname)_$(uname -m).tar.gz"
echo "- Downloading from $URL"
if [ $(command -v curl) ]; then
curl -LSs "$URL" | tar --exclude='README.md' -xz
else
wget -O- "$URL" | tar --exclude='README.md' -xz
fi
if [ $? -ne 0 ]; then
echo "Failed to download from $URL"
exit 1
fi
TARGET="/usr/local/bin/blocc"
echo "- Installing binary to $TARGET"
sudo mv "blocc" "$TARGET"
LOCATION=$(command -v blocc)
echo ""
echo "blocc CLI has been successfully installed!"