-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·53 lines (45 loc) · 1.06 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
#!/bin/sh
# CellPhy installation script
# Created by: Alexey Kozlov, Joao M Alves, Alexandros Stamatakis & David Posada - July 2021
os_detect()
{
if [ `uname -a | grep -c Darwin` -eq 1 ]; then
os=osx
elif [ `uname -a | grep -c Ubuntu` -eq 1 ]; then
os=ubuntu
elif [ `uname -a | grep -c CentOS` -eq 1 ]; then
os=redhat
else
os=unknown
fi
}
install_package()
{
local name=$1
if [ "$os" == "ubuntu" ]; then
sudo apt -y install $name
elif [ "$os" == "redhat" ]; then
sudo yum install $name
elif [ "$os" == "osx" ]; then
echo "Automatic install on macOS is not supported, sorry!"
echo "Please install bcftools and R manually, and re-run this script."
exit 1
else
echo "Unknown OS: $os"
fi
}
os_detect
echo "Operating system detected: $os"
# install bcftools
if [ `which bcftools | wc -l` -eq 0 ]; then
install_package bcftools
fi
# install R
if [ `which Rscript | wc -l` -eq 0 ]; then
install_package r-base
fi
# install R packages
root=`dirname $0`
echo "Installing required R packages..."
$root/script/install.R
echo "Done!"