-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·150 lines (124 loc) · 4.72 KB
/
setup.sh
File metadata and controls
executable file
·150 lines (124 loc) · 4.72 KB
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
#!/bin/bash
# define the directory SCORCH is cloned into
BASEDIR=$PWD
echo -e """
###############################################################
# installing development tools for compiling GWOVina & MGLTools
###############################################################
"""
# install dependencies for xgboost, GWOVina & MGLTools
if [[ "$OSTYPE" == "darwin"* ]]; then
# dependencies for mac
echo -e "\nDetected Max OS X!"
echo -e "Due to GWOVina and MGLTools incompatibilities, please use the SCORCH Docker \nimage to run SCORCH on Mac OS!"
exit
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo -e "\nDetected Linux OS!"
# check if debian or redhat linux distro
installcommand=$(command -v yum)
# if yum doesn't exist, assume debian
if [ -z "$installcommand" ]; then
echo -e "\nDetected Debian! Using apt-get to install packages..."
yes | sudo apt-get update
# install dependencies for debian with apt-get
yes | sudo apt-get install build-essential libboost-all-dev
else
echo -e "\nDetected RedHat! Using yum to install packages..."
# install dependencies for redhat with yum
yes | sudo yum update
yes | sudo yum install boost-devel
yes | sudo yum groupinstall 'Development Tools' --setopt=group_package_types=mandatory,default,optional
fi
fi
echo -e """
###############################################################
# verifying conda install or installing miniconda3 if not found
###############################################################
"""
# check if conda is installed, and install miniconda3 if not
# if conda is not a recognised command then download and install
if ! command -v conda &> /dev/null; then
echo -e "\nNo conda found - installing..."
cd utils && mkdir miniconda3
# if linux then get linux version
if [[ "$OSTYPE" == "linux"* ]]; then
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda3/miniconda.sh --no-check-certificate
# if mac then get mac version
fi
# install miniconda3
cd miniconda3 && chmod -x miniconda.sh
cd $BASEDIR && bash utils/miniconda3/miniconda.sh -b -u -p utils/miniconda3
# remove the installer
rm -f utils/miniconda3/miniconda.sh
# define conda installation paths
CONDA_PATH="utils/miniconda3/bin/conda"
CONDA_BASE=$BASEDIR/utils/miniconda3
CONDA_SH="utils/miniconda3/etc/profile.d/conda.sh"
else
echo -e "\nFound existing conda install!"
# if conda not installed then find location of existing installation
CONDA_PATH=$(which conda)
CONDA_BASE=$(conda info --base)
CONDA_SH=$CONDA_BASE/etc/profile.d/conda.sh
fi
echo -e """
###############################################################
# installing the SCORCH conda environment
###############################################################
"""
# source the bash files to enable conda command in the same session
if test -f ~/.bashrc; then
source ~/.bashrc
fi
if test -f ~/.bash_profile; then
source ~/.bash_profile
fi
# initiate conda
$CONDA_PATH init bash
# source the conda shell script once initiated
source $CONDA_SH
# configure conda to install environment quickly and silently
$CONDA_PATH config --set auto_activate_base false
conda config --set channel_priority strict
# create the conda environment
conda env create -f scorch.yml python=3.6.9
# if linux system, install GWOVina 1.0
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
PLATFORM="linux"
echo -e """
###############################################################
# building GWOVina 1.0 in utils/
###############################################################
"""
cd utils && tar -xzvf gwovina-1.0.tar.gz
cd gwovina-1.0/build/$PLATFORM/release
rm Makefile
echo -e "BASE=/usr/bin\n"\
"BOOST_VERSION=1_59\n"\
"BOOST_INCLUDE=/usr/bin/include\n"\
"C_PLATFORM= -pthread\n"\
"GPP=g++\n"\
"C_OPTIONS= -O3 -DNDEBUG\n"\
"BOOST_LIB_VERSION=\n\n"\
"include ../../makefile_common\n"\ > Makefile
make -j2
fi
# return to the base directory
cd $BASEDIR
echo -e """
###############################################################
# building MGLTools 1.5.6 in utils/
###############################################################
"""
# download the correct install tarball for user OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
PLATFORM='linux'
MGLFOLDER="mgltools_x86_64Linux2_1.5.6"
wget https://ccsb.scripps.edu/download/548/ -O utils/mgltools1-5-6.tar.gz --no-check-certificate
fi
# build MGLTools 1.5.6 in utils folder
cd utils && tar -xzvf mgltools1-5-6.tar.gz
mv $MGLFOLDER MGLTools-1.5.6
cd MGLTools-1.5.6 && ./install.sh
# notify user setup is complete
echo -e "\nSCORCH setup complete!"