-
Notifications
You must be signed in to change notification settings - Fork 30
/
install.sh
executable file
·56 lines (48 loc) · 1.28 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
52
53
54
55
56
#!/bin/bash
INSTALL_DIR="/usr/local"
OWNER_AND_REPO="${OWNER_AND_REPO:-deislabs/spiderlightning}"
BINARY_NAME="slight"
LATEST_RELEASE="$(curl -s https://api.github.com/repos/$OWNER_AND_REPO/releases | grep tag_name | awk 'NR == 1' | cut -d : -f 2 | cut -d \" -f 2)"
echo ">>> LATEST RELEASE: $LATEST_RELEASE..."
OS="$(uname)"
ARCH="$(uname -m)"
if [[ "${OS}" == "Linux" ]]
then
TAR="slight-linux-x86_64.tar.gz"
elif [[ "${OS}" == "Darwin" ]]
then
if [[ "${ARCH}" == "arm64" ]]
then
TAR="slight-macos-aarch64.tar.gz"
else
TAR="slight-macos-amd64.tar.gz"
fi
else
echo ">>> THIS INSTALLATION METHOD ONLY WORKS FOR MACOS AND LINUX."
exit 1
fi
URL="https://github.com/$OWNER_AND_REPO/releases/download/$LATEST_RELEASE/$TAR"
echo ">>> DONLOADING FROM: $URL..."
curl -L -s $URL --output $TAR
echo ">>> DOWNLOADED BINARY TAR."
if [[ "${OS}" == "Linux" ]]
then
tar -xf $TAR
elif [[ "${OS}" == "Darwin" ]]
then
if [[ "${ARCH}" == "arm64" ]]
then
tar -xf $TAR --strip-components=1
else
tar -xf $TAR
fi
else
echo ">>> THIS INSTALLATION METHOD ONLY WORKS FOR MACOS AND LINUX."
exit 1
fi
echo ">>> EXTRACTED BINARY TAR."
sudo install ./release/$BINARY_NAME $INSTALL_DIR/bin
echo ">>> INSTALLED BINARY."
rm $TAR
sudo rm -rf ./release
echo ">>> CLEANED UP."