-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·58 lines (54 loc) · 1.71 KB
/
install.sh
File metadata and controls
executable file
·58 lines (54 loc) · 1.71 KB
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
57
58
#!/bin/bash
set -e
add_to_path() {
shell="$SHELL";
rcfile=".bashrc"
if [[ "$shell" == *"zsh" ]]; then
rcfile=".zshrc";
fi
if grep -q "/.altlimit/bin" "$HOME/$rcfile"; then
echo "~/.altlimit/bin already in zsh path"
else
echo "Adding ~/.altlimit/bin to PATH in $rcfile";
echo 'export PATH=$PATH:$HOME/.altlimit/bin' >> $HOME/$rcfile;
echo "Restart your terminal or run 'source ~/$rcfile'"
fi
}
install_binary() {
if [[ ! -d $HOME/.altlimit/bin ]]; then
echo "Making $HOME/.altlimit/bin"
mkdir -p $HOME/.altlimit/bin;
fi
echo "Downloading latest statusalert binary at: $1";
curl -o $HOME/.altlimit/bin/statusalert.tgz -s -S -L "$1"
tar -xf $HOME/.altlimit/bin/statusalert.tgz -C $HOME/.altlimit/bin/
rm $HOME/.altlimit/bin/statusalert.tgz
if [ $? -ne 0 ]; then
echo "Download failed.";
exit 1;
fi
chmod +x $HOME/.altlimit/bin/statusalert;
add_to_path;
echo "statusalert has been installed at $HOME/.altlimit/bin";
}
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
install_binary "https://github.com/altlimit/statusalert/releases/download/latest/linux.tgz"
else
echo "${MACHINE_TYPE} not supported. Try building from source.";
exit 1;
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
install_binary "https://github.com/altlimit/statusalert/releases/download/latest/darwin.tgz"
else
echo "${MACHINE_TYPE} not supported. Try building from source.";
exit 1;
fi
else
echo "$OSTYPE not yet supported.";
exit 1;
fi