-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.sh
executable file
·76 lines (62 loc) · 1.69 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
if [ -z "$BIN_DIR" ]; then
BIN_DIR=/usr/local/bin
fi
echo "Installing gol to $BIN_DIR"
THE_ARCH_BIN=''
THIS_PROJECT_NAME='gol'
THISOS=$(uname -s)
ARCH=$(uname -m)
DEST=$BIN_DIR/$THIS_PROJECT_NAME
case $THISOS in
Linux*)
case $ARCH in
arm64)
THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-arm64"
;;
aarch64)
THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-arm64"
;;
armv6l)
THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-arm"
;;
armv7l)
THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-arm"
;;
*)
THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-amd64"
;;
esac
;;
Darwin*)
case $ARCH in
arm64)
THE_ARCH_BIN="$THIS_PROJECT_NAME-darwin-arm64"
;;
*)
THE_ARCH_BIN="$THIS_PROJECT_NAME-darwin-amd64"
;;
esac
;;
Windows|MINGW64_NT*)
THE_ARCH_BIN="$THIS_PROJECT_NAME-windows-amd64.exe"
THIS_PROJECT_NAME="$THIS_PROJECT_NAME.exe"
;;
esac
if [ -z "$THE_ARCH_BIN" ]; then
echo "This script is not supported on $THISOS and $ARCH"
exit 1
fi
curl -kL --progress-bar https://github.com/kevincobain2000/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN -o $THIS_PROJECT_NAME
echo "Downloaded $THIS_PROJECT_NAME"
chmod +x $THIS_PROJECT_NAME
SUDO=""
# check if $DEST is writable and suppress an error message
touch "$DEST" 2>/dev/null
# we need sudo powers to write to DEST
if [ $? -eq 1 ]; then
echo "You do not have permission to write to $DEST, enter your password to grant sudo powers"
SUDO="sudo"
fi
$SUDO mv $THIS_PROJECT_NAME "$BIN_DIR"
echo "Installed successfully to: $DEST"