-
Notifications
You must be signed in to change notification settings - Fork 39
/
install
executable file
·399 lines (351 loc) · 13.1 KB
/
install
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
#!/bin/bash
set -o pipefail
# Get version number from git
if [ -d ".git" ] || [ -f ".git" ]; then
# Limits hashes to 7 characters
version=$(git rev-parse HEAD)
printf "%s" "${version:0:7}" > data/version_number
fi
# Create file for TestHub
# This file will be populated during math/test
echo "# If this file contains only this line, install failed before math/test" > testhub.yml
export BUILD_LOG="build.log"
# Get system info
./help > $BUILD_LOG 2>&1
# By scoping the code in brackets we only need to write the redirect once
# at the end of the file
{
function check_okay {
if [ $? -ne 0 ]
then
exit 1
fi
}
function do_one_parallel {
cd $1
check_okay
echo
pwd
echo "building $1 package."
echo
# don't use nice with ./i1 or can miss errors
./i1p
check_okay
cd ..
echo
if [ -f skip_build ] || [ -f "$1/skip_build" ]
then
echo "mesa/$1 has been tested and exported."
elif [ -f skip_test ] || [ -f "$1/skip_test" ]
then
echo "mesa/$1 has been built and exported."
else
echo "mesa/$1 has been built, tested, and exported."
fi
echo
echo "************************************************"
}
function do_one {
cd $1
check_okay
echo
pwd
echo "building $1 package."
echo
# don't use nice with ./i1 or can miss errors
./i1
check_okay
cd ..
echo
if [ -f skip_build ] || [ -f "$1/skip_build" ]
then
echo "mesa/$1 has been tested and exported."
elif [ -f skip_test ] || [ -f "$1/skip_test" ]
then
echo "mesa/$1 has been built and exported."
else
echo "mesa/$1 has been built, tested, and exported."
fi
echo
echo "************************************************"
}
# Block sudo access, this check should come first as if a user blindly types "sudo ./install" then MESA_DIR wont be set
# So lets catch this error first rather then forcing them to set MESA_DIR under sudo
if [ ${EUID:-$(id -u)} -eq 0 ];
then
echo
echo "****************************************************************"
echo "* *"
echo "* MESA should not be installed with root privileges. *"
echo "* Using sudo is a bad idea and unlikely to fix the *"
echo "* problem you think you have. *"
echo "* *"
echo "* If you have permission issues, *"
echo "* contact the mesa-users mailing list. *"
echo "* *"
echo "* If you wish to install MESA in a root location *"
echo "* then we assume you can edit the *"
echo "* ./install file to remove this check. *"
echo "* *"
echo "****************************************************************"
echo
exit 1
fi
# Check we are on git and if so did git lfs work?
if [ -d ".git" ] || [ -f ".git" ]
then
# First check if git lfs is installed
if ! command -v git-lfs >/dev/null 2>&1
then
echo
echo "****************************************************************"
echo "* git lfs is not installed *"
echo "* *"
echo "****************************************************************"
echo
exit 1
fi
# empirically on lustre filesystems the LFS files don't immediately appear
# if requested, sleep for a bit before proceeding and doing the check
if [ -n "${MESA_GIT_LFS_SLEEP}" ]; then
sleep ${MESA_GIT_LFS_SLEEP}
fi
# check that each LFS file has a full copy on disk
FILE_LIST=$(git-lfs ls-files | awk '{print $NF}')
for LFS_FILE in ${FILE_LIST}; do
# the checks have this form to handle uncommitted changes to LFS files
# if no file exists, that means the file was probably deleted and that's OK
# if the file exists, but is short, then it is probably the bare LFS pointer
# and that indicates a problem retrieving the file
if [ -f "${LFS_FILE}" ] && [ $(du -k "${LFS_FILE}" | cut -f1) -le 4 ];
then
echo
echo "${LFS_FILE} is smaller than expected for a file tracked by git LFS"
echo
echo "****************************************************************"
echo "* Some data files were not successfully retrieved *"
echo "* *"
echo "* Try running: *"
echo "* git lfs install --force *"
echo "* and then *"
echo "* git lfs pull *"
echo "* *"
echo "****************************************************************"
echo
exit 1
fi
done
fi
if [ -z "$MESA_DIR" ]
then
if [ -z "$MESA_DIR_INTENTIONALLY_EMPTY" ]
then
echo
echo "****************************************************************"
echo "* *"
echo "* MESA_DIR is not set *"
echo "* Please set MESA_DIR and run ./mk again *"
echo "* *"
echo "* Please also read: *"
echo "* http://www.astro.wisc.edu/~townsend/static.php?ref=mesasdk *"
echo "* To set up the MESASDK *"
echo "* *"
echo "****************************************************************"
echo
exit 1
fi
fi
if [[ "$MESA_DIR" == *" "* ]];
then
echo
echo "****************************************************************"
echo "* *"
echo "* MESA_DIR can not contain whitespace *"
echo "* Please move your MESA_DIR to a folder *"
echo "* without spaces in its name *"
echo "* *"
echo "****************************************************************"
echo
exit 1
fi
# there is also a tool called ndiff which is part of the nmap security
# scanner. if called with the -? argument, that tool returns 2.
# The ndiff utility we want recognizes this will return 0.
# We send the output, which is on stderr, to dev/null
ndiff -? 2> /dev/null
if [ $? -ne 0 ]
then
echo
echo "****************************************************************"
echo "* *"
echo "* You need to install ndiff before you can install mesa. *"
echo "* *"
echo "* *"
echo "* But only if you are not using the SDK. If you see this *"
echo "* message and are trying to use the sdk *"
echo "* then please check your environment variables *"
echo "* are set first. *"
echo "* *"
echo "* *"
echo "* The ndiff tar file is in the mesa/scripts directory. *"
echo "* Unpack it anywhere (tar -zxvf ndiff-2.00.tar.gz), *"
echo "* and cd to the ndiff directory. *"
echo "* Then do the usual sequence: *"
echo "* *"
echo "* ./configure *"
echo "* make all *"
echo "* sudo make install *"
echo "* *"
echo "* Note: 'make check' seems to give lots of false alarms. *"
echo "* I suggest skipping that step in the ndiff installation. *"
echo "* *"
echo "* BTW: there's another 'ndiff' out there in the unix world. *"
echo "* http://nmap.org/ndiff/ *"
echo "* I'm sure it's a great tool, but it isn't what we need. *"
echo "* *"
echo "****************************************************************"
echo
exit 1
fi
makedepf90 > /dev/null
if [ $? -ne 0 ]
then
echo
echo "*******************************************************************"
echo "* *"
echo "* You need to install makedepf90 before you can install mesa. *"
echo "* *"
echo "* *"
echo "* But only if you are not using the SDK. If you see this *"
echo "* message and are trying to use the sdk *"
echo "* then please check your environment variables *"
echo "* are set first. *"
echo "* *"
echo "* *"
echo "* The makedepf90 tar file is in the mesa/scripts directory. *"
echo "* Unpack it anywhere (tar -zxvf makedepf90-2.8.8.tar.gz), *"
echo "* and cd to the makedepf90-2.8.8 directory. *"
echo "* Then do the usual sequence: *"
echo "* *"
echo "* ./configure *"
echo "* make all *"
echo "* sudo make install *"
echo "* *"
echo "* Note: 'make test' doesn't seem to work. I suggest skipping *"
echo "* that step in the makedepf90 installation. *"
echo "* *"
echo "******************************************************************"
echo
exit 1
fi
if [ ! -r lib ]
then
mkdir lib
fi
if [ ! -r include ]
then
mkdir include
fi
do_one_parallel const
do_one utils
do_one_parallel math
do_one_parallel mtx
do_one_parallel auto_diff
do_one_parallel forum
do_one_parallel num
do_one_parallel interp_1d
do_one_parallel interp_2d
if [ ! -r data ]
then
echo
echo "******************************************************************"
echo "* *"
echo "* Please setup the current mesa data before doing ./install *"
echo "* See the mesa README file for details. *"
echo "* *"
echo "******************************************************************"
echo
exit 1
fi
function do_input_data {
cd $1
check_okay
echo
pwd
echo "installing mesa $1 data."
echo
# don't use nice or can miss errors
./build_data_and_export
check_okay
echo "$1 data successfully installed."
echo
echo "************************************************"
cd ..
}
if [ ! -r data/chem_data ]
then
do_input_data chem
fi
do_one_parallel chem
if [ ! -r data/colors_data ]
then
do_input_data colors
fi
do_one_parallel colors
# get rid of obsolete eos_data directory
rm -rf data/eos_data
# check that the eos data directories exist
if [ ! -r data/eosDT_data ]
then
do_input_data eos
fi
# now have installed eos data, so can install the eos module
do_one_parallel eos
if [ ! -r data/kap_data ]
then
do_input_data kap
fi
do_one_parallel kap
do_one_parallel rates
do_one_parallel neu
do_one_parallel net
if [ ! -r data/ionization_data ]
then
do_input_data ionization
fi
do_one_parallel ionization
if [ ! -r data/atm_data ]
then
do_input_data atm
fi
do_one atm
do_one turb
do_one sample
do_one star_data
do_one_parallel gyre
do_one adipls
do_one_parallel star
do_one_parallel binary
do_one_parallel astero
echo
echo
echo
echo
echo
echo
echo
echo "************************************************"
echo "************************************************"
echo "************************************************"
echo
echo 'MESA installation was successful'
echo
echo "************************************************"
echo "************************************************"
echo "************************************************"
echo
echo
echo
echo
# end scope and redirect output
} 2>&1 | tee -a $BUILD_LOG