-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap_pnet_ci.sh
executable file
·220 lines (187 loc) · 6.4 KB
/
bootstrap_pnet_ci.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#!/usr/bin/env bash
# Determine if we're using apt-get or yum
PKG_CMD=""
USE_APT=""
USE_YUM=""
#### Install base development packages.
if [ `which apt-get | wc -w` -gt 0 ]; then
USE_APT="TRUE"
PKG_CMD=`which apt-get`
PKG_UPDATE="$PKG_CMD update"
PKG_LIST="ubuntu-dev-tools m4 git libjpeg-dev libcurl4-openssl-dev wget htop libtool bison flex autoconf curl g++ midori libopenmpi-dev openmpi-bin emacs24 gfortran"
GRP_LIST=""
elif [ `which yum | wc -w` -gt 0 ]; then
USE_YUM="TRUE"
PKG_UPDATE=""
PKG_CMD=`which yum`
PKG_LIST="m4 git libjpeg-turbo-devel libcurl-devel wget nano libtool bison flex autoconf curl"
GRP_LIST="yum -y groupinstall 'Development tools'"
fi
$PKG_UPDATE
$PKG_CMD -y upgrade
$PKG_CMD -y install $PKG_LIST
$GRP_LIST
#####
# Enable Cron to run automatically.
#####
if [ `which update-rc.d | wc -w` -gt 0 ]; then
update-rc.d crond defaults
elif [ `which chkconfig | wc -w` -gt 0 ]; then
chkconfig crond on
fi
#####
# Set the proper timezone.
#####
if [ -f "/usr/sbin/dpkg-reconfigure" ]; then
echo "US/Mountain" | tee /etc/timezone
dpkg-reconfigure --frontend noninteractive tzdata
elif [ -f /usr/share/zoneinfo/America/Denver ]; then
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/America/Denver /etc/localtime
fi
#####
# Install ctest as a script.
# It is installed into /etc/init.d/ctest
#####
if [ `which update-rc.d | wc -w` -gt 0 ]; then
update-rc.d cron defaults
elif [ `which chkconfig | wc -w` -gt 0 ]; then
chkconfig crond on
fi
#####
# Install CTest as a script in the 'vagrant' home directory.
#####
CTEST_INIT="/home/vagrant/ctest_service.sh"
LOCKFILE="/vagrant/NOTEST"
echo '#!/bin/bash' > $CTEST_INIT
echo 'sleep 10' >> $CTEST_INIT
echo "LFILE=\"$LOCKFILE\"" >> $CTEST_INIT
echo 'CTEST_HOME="/home/vagrant/ctest_scripts"' >> $CTEST_INIT
echo 'DASH="$CTEST_HOME/Dashboards"' >> $CTEST_INIT
echo 'rm -rf $CTEST_HOME' >> $CTEST_INIT
echo '/bin/mkdir -p $CTEST_HOME' >> $CTEST_INIT
echo "count=0" >> $CTEST_INIT
echo 'while [ $count -lt 10 ]; do' >> $CTEST_INIT
echo " if [ -f /vagrant/Vagrantfile ]; then" >> $CTEST_INIT
echo " count=50" >> $CTEST_INIT
echo " else" >> $CTEST_INIT
echo ' echo "Waiting for /vagrant to be mounted."' >> $CTEST_INIT
echo ' count=`expr $count + 1`' >> $CTEST_INIT
echo ' sleep 5' >> $CTEST_INIT
echo ' fi' >> $CTEST_INIT
echo 'done' >> $CTEST_INIT
echo "if [ -d /vagrant ]; then" >> $CTEST_INIT
echo " find -L /vagrant -maxdepth 1 -type f -exec cp {} /home/vagrant/ctest_scripts \;" >> $CTEST_INIT
echo "else" >> $CTEST_INIT
echo " exit 1" >> $CTEST_INIT
echo "fi" >> $CTEST_INIT
#echo "chown -R vagrant:vagrant /home/vagrant/ctest_scripts" >> $CTEST_INIT
echo ' if [ ! -f /usr/local/bin/ctest ]; then' >> $CTEST_INIT
echo ' echo "ctest not found"' >> $CTEST_INIT
echo ' exit 1' >> $CTEST_INIT
echo ' fi' >> $CTEST_INIT
echo ' /bin/rm -rf $DASH' >> $CTEST_INIT
echo ' echo "Starting ctest"' >> $CTEST_INIT
echo ' cd /home/vagrant/ctest_scripts/' >> $CTEST_INIT
echo ' /usr/local/bin/ctest -V -S PARCI.cmake > continuous_test.out 2>&1 &' >> $CTEST_INIT
echo 'exit $RETVAL' >> $CTEST_INIT
chmod 755 $CTEST_INIT
#update-rc.d ctest defaults 99
####
# End installation of ctest as a script.
# Note: We can't start it yet, ctest and hdf libraries
# haven't been installed yet.
####
### Install a crontab for running nightly tests.
sudo -i -u vagrant echo "@reboot $CTEST_INIT" > /home/vagrant/crontab.in
sudo -i -u vagrant echo '01 0 * * * cd /home/vagrant/ctest_scripts && /home/vagrant/ctest_scripts/run_nightly_test.sh > nightly_log.txt' >> /home/vagrant/crontab.in
sudo -i -u vagrant crontab < /home/vagrant/crontab.in
rm /home/vagrant/crontab.in
## Install several packages from source.
# * cmake
# * hdf4
# * hdf5
CMAKE_VER="cmake-3.0.2"
HDF4_VER="hdf-4.2.10"
HDF5_VER="hdf5-1.8.13"
PNET_VER="parallel-netcdf-1.4.1"
# Install cmake from source
if [ ! -f /usr/local/bin/cmake ]; then
CMAKE_FILE="$CMAKE_VER".tar.gz
if [ ! -f "/vagrant/$CMAKE_FILE" ]; then
wget http://www.cmake.org/files/v3.0/$CMAKE_FILE
cp "$CMAKE_FILE" /vagrant
else
cp "/vagrant/$CMAKE_FILE" .
fi
tar -zxf $CMAKE_FILE
pushd $CMAKE_VER
./configure --prefix=/usr/local
make install
popd
rm -rf $CMAKE_VER
fi
# Install hdf4 from source.
if [ ! -f /usr/local/lib/libhdf4.settings ]; then
HDF4_FILE="$HDF4_VER".tar.bz2
if [ ! -f "/vagrant/$HDF4_FILE" ]; then
wget http://www.hdfgroup.org/ftp/HDF/HDF_Current/src/$HDF4_FILE
cp "$HDF4_FILE" /vagrant
else
cp "/vagrant/$HDF4_FILE" .
fi
tar -jxf $HDF4_FILE
pushd $HDF4_VER
CC=`which mpicc` ./configure --disable-static --enable-shared --disable-netcdf --disable-fortran --prefix=/usr/local
sudo make install
popd
rm -rf $HDF4_VER
fi
# Install hdf5 from source
if [ ! -f /usr/local/lib/libhdf5.settings ]; then
HDF5_FILE="$HDF5_VER".tar.bz2
if [ ! -f "/vagrant/$HDF5_FILE" ]; then
wget http://www.hdfgroup.org/ftp/HDF5/current/src/$HDF5_FILE
cp "$HDF5_FILE" /vagrant
else
cp "/vagrant/$HDF5_FILE" .
fi
tar -jxf $HDF5_FILE
pushd $HDF5_VER
CC=`which mpicc` ./configure --enable-shared --disable-static --disable-fortran --enable-hl --disable-parallel --prefix=/usr/local
make install
popd
rm -rf $HDF5_VER
fi
# Install pnetcdf from source
if [ ! -f /usr/local/lib/libpnetcdf.a ]; then
PNET_FILE="$PNET_VER.tar.bz2"
if [ ! -f "/vagrant/$PNET_FILE" ]; then
wget http://cucis.ece.northwestern.edu/projects/PnetCDF/Release/$PNET_FILE
cp "$PNET_FILE" /vagrant
else
cp "/vagrant/$PNET_FILE" .
fi
tar -jxf $PNET_FILE
pushd $PNET_VER
CPPFLAGS="-fPIC" CC=`which mpicc` ./configure --prefix=/usr/local
make -k install
popd
rm -rf $PNET_VER
fi
#####
# Set up git
#####
sudo -i -u vagrant git config --global user.name "Ward Fisher"
sudo -i -u vagrant git config --global user.email "[email protected]"
sudo -i -u vagrant git config --global push.default simple
#####
# Set up .emacs file
#####
echo "(set-face-attribute 'default nil :height 130)" >> /home/vagrant/.emacs
echo '(custom-set-variables' >> /home/vagrant/.emacs
echo " '(inhibit-startup-screen t)" >> /home/vagrant/.emacs
echo " '(show-paren-mode t)" >> /home/vagrant/.emacs
echo " '(uniquify-buffer-name-style (quote forward) nil (uniquify)))" >> /home/vagrant/.emacs
chown -R vagrant:vagrant /home/vagrant
sudo -i -u vagrant $CTEST_INIT