-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
93 lines (81 loc) · 1.82 KB
/
setup.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/env bash
echo "Detecting OS"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# Linux
which -s aria2c
if [[ $? != 0 ]] ; then
which -s wget
if [[ $? != 0 ]] ; then
# curl
function download {
curl "$1" > "$2"
}
else
# wget
function download {
wget "$1" -O "$2"
}
fi
else
# aria2
function download {
aria2c "$1" -o "%2"
}
fi
echo "Downloading Flow.."
download "https://facebook.github.io/flow/downloads/flow-linux64-latest.zip" "flow-linux64-latest.zip"
unzip flow-linux64-latest.zip -d flow
echo "Detecting package manager for your distribution"
declare -A osInfo;
osInfo[/etc/redhat-release]=yum
osInfo[/etc/arch-release]=pacman
osInfo[/etc/gentoo-release]=emerge
osInfo[/etc/SuSE-release]=zypp
osInfo[/etc/debian_version]=apt-get
for f in ${!osInfo[@]}
do
if [[ -f $f ]]; then
if [[ ${osInfo[$f]} == "yum" ]]; then
which -s dnf
if [[ $? != 0 ]]; then
echo "Package manager:" ${osInfo[$f]}
sudo ${osInfo[$f]} install xsel
else
echo "Package manager: DNF"
sudo dnf install xsel
fi
else
echo "Package manager:" ${osInfo[$f]}
sudo ${osInfo[$f]} install xsel
fi
fi
done
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
which -s brew
if [[ $? != 0 ]] ; then
echo "Firtly, we need to install Brew. Do you want to do it now?"
select result in Yes No
do
if [[ "$result" == "Yes" ]]; then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Okay. Aborting installation"
exit
fi
done
else
brew update
brew install flow
fi
elif [[ "$OSTYPE" == "cygwin" ]]; then
# Windows / cygwin
elif [[ "$OSTYPE" == "msys" ]]; then
# Windows / mingw
elif [[ "$OSTYPE" == "win32" ]]; then
# Windows
elif [[ "$OSTYPE" == "freebsd"* ]]; then
# FreeBSD
else
# Unknown.
fi