forked from VimCommando/fx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
75 lines (58 loc) · 1.6 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
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
put() {
echo -e "\e[1;32m$1\e[0m"
}
do_install() {
cat <<'EOM'
______ _____ _ _ _
| ____| |_ _| | | | | |
| |____ __ | | _ __ ___| |_ __ _| | | ___ _ __
| __\ \/ / | | | '_ \/ __| __/ _` | | |/ _ \ '__|
| | > < _| |_| | | \__ \ || (_| | | | __/ |
|_| /_/\_\ |_____|_| |_|___/\__\__,_|_|_|\___|_|
EOM
platform=''
if [[ "$OSTYPE" == "linux"* ]]; then
platform='linux'
elif [[ "$OSTYPE" == "darwin"* ]]; then
platform='macos'
elif [[ "$OSTYPE" == "win"* ]]; then
platform='win.exe'
fi
if test "x$platform" = "x"; then
cat <<EOM
/=====================================\\
| COULD NOT DETECT PLATFORM |
\\=====================================/
Uh oh! We couldn't automatically detect your operating system.
Please, download fx from https://github.com/antonmedv/fx/releases manually.
EOM
exit 2
else
put "Detected platform: $platform"
fi
put "Downloading latest fx-$platform.zip"
curl -L "https://github.com/antonmedv/fx/releases/latest/download/fx-$platform.zip" > "fx-$platform.zip"
put "Extracting fx-$platform.zip"
unzip "fx-$platform.zip"
rm "fx-$platform.zip"
mv "fx-$platform" fx
name=''
read -p $'\e[1;35mWhould you like to move fx binary to /usr/local/bin?\e[0m [Y/n] ' -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
mv fx /usr/local/bin/fx
name='fx'
else
name='./fx'
fi
cat <<EOM
Now you can start using fx.
$ $name '.downloadCount + 1'
EOM
curl -sAx http://bit.ly/downloads-count > /dev/null
}
do_install