forked from AndreasHeger/CGATReport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·164 lines (120 loc) · 4.35 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/bash -xe
ROOT_DIR="$( dirname "${BASH_SOURCE[0]}" )"
if [[ -z "$CONDA_PY" ]]; then
CONDA_PY=2.7
fi
CONDA_INSTALL_TYPE=basic
if [[ -z "$CONDA_INSTALL_DIR" ]]; then
CONDA_INSTALL_DIR=$(readlink -f env)
fi
if [[ -z "$TRAVIS_BUILD_DIR" ]]; then
TRAVIS_BUILD_DIR="."
fi
CONDA_CHANNELS="--channel defaults --channel conda-forge --channel bioconda --channel r"
CONDA_PACKAGES="pillow seaborn pandas seaborn scipy numpy matplotlib jpeg rpy2 r-ggplot2 r-gplots"
# log installation information
log() {
echo "# CGATReport log | `hostname` | `date` | $1 "
}
# printenv
# function to detect the Operating System
detect_os() {
if [ -f /etc/os-release ]; then
OS=$(cat /etc/os-release | awk '/VERSION_ID/ {sub("="," "); print $2;}' | sed 's/\"//g' | awk '{sub("\\."," "); print $1;}')
if [ "$OS" != "12" ] ; then
echo
echo " Sorry, this version of Ubuntu has not been tested. Only Ubuntu 12.x is supported so far. "
echo
exit 1;
fi
OS="ubuntu"
elif [ -f /etc/system-release ]; then
OP=$(cat /etc/system-release | awk ' {print $1;}')
if [ "$OP" == "Scientific" ] ; then
OP=$(cat /etc/system-release | awk ' {print $4;}' | awk '{sub("\\."," "); print $1;}')
if [ "$OP" != "6" ] ; then
echo
echo " Sorry, this version of Scientific Linux has not been tested. Only 6.x versions are supported so far. "
echo
exit 1;
else
OS="sl"
fi
elif [ "$OP" == "CentOS" ] ; then
OP=$(cat /etc/system-release | awk ' {print $3;}' | awk '{sub("\\."," "); print $1;}')
if [ "$OP" != "6" ] ; then
echo
echo " Sorry, this version of CentOS has not been tested. Only 6.x versions are supported so far. "
echo
exit 1;
else
OS="centos"
fi
fi
fi
} # detect_os
# install operating system dependencies
install_os_packages() {
detect_os
if [ "$OS" == "ubuntu" ] || [ "$OS" == "travis" ] ; then
echo
echo " Installing packages for Ubuntu "
echo
sudo apt-get --quiet install -y gcc g++ zlib1g-dev libssl-dev libssl1.0.0 libbz2-dev libfreetype6-dev libpng12-dev libblas-dev libatlas-dev liblapack-dev gfortran libpq-dev r-base-dev libreadline-dev libmysqlclient-dev libboost-dev libsqlite3-dev libcairo2-dev
elif [ "$OS" == "sl" ] || [ "$OS" == "centos" ] ; then
echo
echo " Installing packages for Scientific Linux / CentOS "
echo
yum -y install gcc zlib-devel openssl-devel bzip2-devel gcc-c++ freetype-devel libpng-devel blas atlas lapack gcc-gfortran postgresql-devel R-core-devel readline-devel mysql-devel boost-devel sqlite-devel xorg-x11-fonts-75dpi xorg-x11-fonts-100dpi org-x11-server-Xvfb cairo-devel
# cairo-dev/libcairo2-dev required for R package svglite
#
# additional configuration for scipy (Scientific Linux only)
if [ "$OS" == "sl" ] ; then
ln -s /usr/lib64/libatlas.so.3 /usr/lib64/libatlas.so
fi
# additional configuration for blas and lapack
ln -s /usr/lib64/libblas.so.3 /usr/lib64/libblas.so
ln -s /usr/lib64/liblapack.so.3 /usr/lib64/liblapack.so;
else
sanity_check_os $OS
fi # if-OS
} # install_os_packages
# install_os_packages
# download and install conda
if [ ! -d "$CONDA_INSTALL_DIR" ]; then
log "installing conda into $CONDA_INSTALL_DIR"
rm -f Miniconda-latest-Linux-x86_64.sh
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
rm -rf "$CONDA_INSTALL_DIR"
bash Miniconda3-latest-Linux-x86_64.sh -b -p "$CONDA_INSTALL_DIR"
hash -r
else
log "using existing conda enviroment in $CONDA_INSTALL_DIR"
fi
# conda update conda --yes
# conda info -a
log "creating conda environment"
"$CONDA_INSTALL_DIR"/bin/conda create --yes \
-n "$CONDA_INSTALL_TYPE" \
--override-channels $CONDA_CHANNELS \
python="$CONDA_PY" \
$CONDA_PACKAGES
# set +o nounset
source "$CONDA_INSTALL_DIR"/bin/activate "$CONDA_INSTALL_TYPE"
# set -o nounset
log "installing R dependencies"
R -f "$ROOT_DIR"/install.R
log "installing conda dependencies"
which conda
# The following packages will be pulled in through pip:
# mpld3
log "installing ggplot upgrade"
pip install --upgrade --no-dependencies ggplot
echo "setting up CGATReport"
# setup CGATPipelines
cd "$TRAVIS_BUILD_DIR"
python setup.py develop
# log "building report"
# cd doc && make html
# cd $TRAVIS_BUILD_DIR
# cat doc/cgatreport.log | cut -d " " -f 3 | sort | uniq -c