-
Notifications
You must be signed in to change notification settings - Fork 0
/
galacticusInstall.sh
executable file
·2328 lines (2232 loc) · 84.8 KB
/
galacticusInstall.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
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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
# Galacticus install script.
# Copyright Andrew Benson 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
# Functions
function contains() {
local n=$#
local value=${!n}
for ((i=1;i < $#;i++)) {
if [ "${!i}" == "${value}" ]; then
echo "y"
return 0
fi
}
echo "n"
return 1
}
function logexec()
{
echo \-\-\> "$@" >> $glcLogFile
eval "$@" >> $glcLogFile 2>&1
}
function logmessage()
{
echo "$@"
echo "$@" >>$glcLogFile 2>&1
}
# Define a log file.
glcLogFile=`pwd`"/galacticusInstall.log"
# Get arugments.
TEMP=`getopt -o t --long toolPrefix::,asRoot::,rootPwd::,suMethod::,installLevel::,packageManager::,cores::,galacticusPrefix::,setCShell::,setBash::,ignoreFailures::,catLogOnError:: -- "$@"`
eval set -- "$TEMP"
cmdToolPrefix=
cmdAsRoot=
cmdRootPwd=
cmdInstallLevel=
cmdPackageManager=
cmdCores=
cmdSuMethod=
cmdGalacticusPrefix=
cmdSetCShell=
cmdSetBash=
cmdIgnoreFailures=
cmdCatLogOnError=
while true; do
case "$1" in
--asRoot ) cmdAsRoot="$2"; shift 2 ;;
--cores ) cmdCores="$2"; shift 2 ;;
--galacticusPrefix ) cmdGalacticusPrefix="$2"; shift 2 ;;
--installLevel ) cmdInstallLevel="$2"; shift 2 ;;
--packageManager ) cmdPackageManager="$2"; shift 2 ;;
--rootPwd ) cmdRootPwd="$2"; shift 2 ;;
--setCShell ) cmdSetCShell="$2"; shift 2 ;;
--setBash ) cmdSetBash="$2"; shift 2 ;;
--ignoreFailures ) cmdIgnoreFailures="$2"; shift 2 ;;
--catLogOnError ) cmdCatLogOnError="$2"; shift 2 ;;
--suMethod ) cmdSuMethod="$2"; shift 2 ;;
--toolPrefix ) cmdToolPrefix="$2"; shift 2 ;;
-- ) shift; break ;;
* ) break ;;
esac
done
# Validate arguments.
if [ ! -z ${cmdAsRoot} ]; then
if [[ ${cmdAsRoot} != "no" && ${cmdAsRoot} != "yes" ]]; then
logmessage "asRoot option should be 'yes' or 'no'"
exit 1
fi
fi
if [ ! -z ${cmdSetCShell} ]; then
if [[ ${cmdSetCShell} != "no" && ${cmdSetCShell} != "yes" ]]; then
logmessage "setCShell option should be 'yes' or 'no'"
exit 1
fi
fi
if [ ! -z ${cmdSetBash} ]; then
if [[ ${cmdSetBash} != "no" && ${cmdSetBash} != "yes" ]]; then
logmessage "setBash option should be 'yes' or 'no'"
exit 1
fi
fi
if [ ! -z ${cmdIgnoreFailures} ]; then
if [[ ${cmdIgnoreFailures} != "no" && ${cmdIgnoreFailures} != "yes" ]]; then
logmessage "ignoreFailures option should be 'yes' or 'no'"
exit 1
fi
fi
if [ ! -z ${cmdCatLogOnError} ]; then
if [[ ${cmdCatLogOnError} != "no" && ${cmdCatLogOnError} != "yes" ]]; then
logmessage "catLogOnError option should be 'yes' or 'no'"
exit 1
fi
fi
if [ ! -z ${cmdSuMethod} ]; then
if [[ ${cmdSuMethod} != "su" && ${cmdSuMethod} != "sudo" ]]; then
logmessage "suMethod option should be 'su' or 'sudo'"
exit 1
fi
fi
if [ ! -z ${cmdPackageManager} ]; then
if [[ ${cmdPackageManager} != "no" && ${cmdPackageManager} != "yes" ]]; then
logmessage "packageManager option should be 'yes' or 'no'"
exit 1
fi
fi
if [ ! -z ${cmdInstallLevel} ]; then
if [[ ${cmdInstallLevel} != "binary" && ${cmdInstallLevel} != "minimal" && ${cmdInstallLevel} != "full" ]]; then
logmessage "installLevel option should be 'binary', 'minimal', or 'full'"
exit 1
fi
fi
if [ ! -z ${cmdCores} ]; then
if [[ ! ${cmdCores} =~ ^[0-9]+$ ]]; then
logmessage "cores option should be an integer"
exit 1
fi
fi
# Set defaults.
catLogOnError="no"
if [ ! -z ${cmdCatLogOnError} ]; then
catLogOnError=$cmdCatLogOnError
fi
# Open the log file.
echo "Galacticus install log" > $glcLogFile
# Write some useful machine info to the log file if possible.
hash uname >& /dev/null
if [ $? -eq 0 ]; then
uname -a >>$glcLogFile 2>&1
fi
# Create an install folder, and move into it.
mkdir -p galacticusInstallWork
cd galacticusInstallWork
# Do we want to install as root, or as a regular user?
if [[ $UID -eq 0 ]]; then
echo "Script is being run as root."
echo "Script is being run as root." >> $glcLogFile
installAsRoot=1
runningAsRoot=1
# Set up a suitable install path.
if [ -z ${cmdToolPrefix} ]; then
toolInstallPath=/usr/local/galacticus
read -p "Path to install tools to as root [$toolInstallPath]: " RESPONSE
if [ -n "$RESPONSE" ]; then
toolInstallPath=$RESPONSE
fi
else
toolInstallPath=${cmdToolPrefix}
fi
else
installAsRoot=-1
runningAsRoot=0
fi
while [ $installAsRoot -eq -1 ]
do
if [ -z ${cmdAsRoot} ]; then
read -p "Install required libraries and Perl modules as root (requires root password)? [no/yes]: " RESPONSE
else
RESPONSE=${cmdAsRoot}
fi
if [ "$RESPONSE" = yes ] ; then
# Installation will be done as root where possible.
installAsRoot=1
# Ask whether we should use "su" or "sudo" for root installs.
suCommand="null"
while [[ $suCommand == "null" ]]
do
if [ -z ${cmdSuMethod} ]; then
read -p "Use sudo or su for root installs:" suMethod
else
suMethod=$cmdSuMethod
fi
if [[ $suMethod == "su" ]]; then
suCommand="su -c \""
suClose="\""
pName="root"
elif [[ $suMethod == "sudo" ]]; then
suCommand="sudo -E -S -- "
suClose=""
pName="sudo"
fi
done
# Get the root password.
if [ -z ${cmdRootPwd} ]; then
read -s -p "Please enter the $pName password:" rootPassword
else
rootPassword=$cmdRootPwd
fi
echo "$rootPassword" | eval $suCommand echo worked $suClose >& /dev/null
echo
if [ $? -ne 0 ] ; then
echo "$pName password was incorrect, exiting"
exit 1
fi
echo "Libraries and Perl modules will be installed as root"
echo "Libraries and Perl modules will be installed as root" >> $glcLogFile
# Set up a suitable install path.
if [ -z ${cmdToolPrefix} ]; then
toolInstallPath=/usr/local/galacticus
read -p "Path to install tools to as root [$toolInstallPath]: " RESPONSE
if [ -n "$RESPONSE" ]; then
toolInstallPath=$RESPONSE
fi
else
toolInstallPath=${cmdToolPrefix}
fi
elif [ "$RESPONSE" = no ] ; then
# Install as regular user.
installAsRoot=0
echo "Libraries and Perl modules will be installed as regular user"
echo "Libraries and Perl modules will be installed as regular user" >> $glcLogFile
# Set yp a suitable install path.
if [ -z ${cmdToolPrefix} ]; then
toolInstallPath=$HOME/Galacticus/Tools
read -p "Path to install tools to [$toolInstallPath]: " RESPONSE
if [ -n "$RESPONSE" ]; then
toolInstallPath=$RESPONSE
fi
else
toolInstallPath=${cmdToolPrefix}
fi
else
# Response invalid, try again.
echo "Please enter 'yes' or 'no'"
fi
done
# Export various environment variables with our install path prepended.
if [ -n "${PKG_CONFIG_PATH}" ]; then
export PKG_CONFIG_PATH=$toolInstallPath/lib/pkgconfig:$PKG_CONFIG_PATH
else
export PKG_CONFIG_PATH=$toolInstallPath/lib/pkgconfig
fi
if [ -n "${PATH}" ]; then
export PATH=$toolInstallPath/bin:$PATH
else
export PATH=$toolInstallPath/bin
fi
if [ -n "${LD_LIBRARY_PATH}" ]; then
export LD_LIBRARY_PATH=$toolInstallPath/lib:$toolInstallPath/lib64:$LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=$toolInstallPath/lib:$toolInstallPath/lib64
fi
if [ -n "${LD_RUN_PATH}" ]; then
export LD_RUN_PATH=$toolInstallPath/lib:$toolInstallPath/lib64:$LD_RUN_PATH
else
export LD_RUN_PATH=$toolInstallPath/lib:$toolInstallPath/lib64
fi
if [ -n "${LDFLAGS}" ]; then
export LDFLAGS="-L$toolInstallPath/lib:$toolInstallPath/lib64:$LDFLAGS_PATH"
else
export LDFLAGS="-L$toolInstallPath/lib:$toolInstallPath/lib64"
fi
if [ -n "${C_INCLUDE_PATH}" ]; then
export C_INCLUDE_PATH=$toolInstallPath/include:$C_INCLUDE_PATH
else
export C_INCLUDE_PATH=$toolInstallPath/include
fi
if [ -n "${PERLLIB}" ]; then
export PERLLIB=$HOME/perl5/lib/perl5:$toolInstallPath/lib/perl5:$HOME/perl5/lib64/perl5:$toolInstallPath/lib64/perl5:$HOME/perl5/lib/perl5/site_perl:$toolInstallPath/lib/perl5/site_perl:$HOME/perl5/lib64/perl5/site_perl:$toolInstallPath/lib64/perl5/site_perl:$PERLLIB
else
export PERLLIB=$HOME/perl5/lib/perl5:$toolInstallPath/lib/perl5:$HOME/perl5/lib64/perl5:$toolInstallPath/lib64/perl5:$HOME/perl5/lib/perl5/site_perl:$toolInstallPath/lib/perl5/site_perl:$HOME/perl5/lib64/perl5/site_perl:$toolInstallPath/lib64/perl5/site_perl
fi
if [ -n "${PERL5LIB}" ]; then
export PERL5LIB=$HOME/perl5/lib/perl5:$toolInstallPath/lib/perl5:$HOME/perl5/lib64/perl5:$toolInstallPath/lib64/perl5:$HOME/perl5/lib/perl5/site_perl:$toolInstallPath/lib/perl5/site_perl:$HOME/perl5/lib64/perl5/site_perl:$toolInstallPath/lib64/perl5/site_perl:$PERL5LIB
else
export PERL5LIB=$HOME/perl5/lib/perl5:$toolInstallPath/lib/perl5:$HOME/perl5/lib64/perl5:$toolInstallPath/lib64/perl5:$HOME/perl5/lib/perl5/site_perl:$toolInstallPath/lib/perl5/site_perl:$HOME/perl5/lib64/perl5/site_perl:$toolInstallPath/lib64/perl5/site_perl
fi
# Ensure that we use GNU compilers.
export CC=gcc
export CXX=g++
export FC=gfortran
# Use a package manager?
if [ $installAsRoot -eq 1 ]; then
usePackageManager=-1
while [ $usePackageManager -eq -1 ]
do
if [ -z $cmdPackageManager ]; then
read -p "Use package manager for install (if available)?: " RESPONSE
else
RESPONSE=$cmdPackageManager
fi
if [ "$RESPONSE" = yes ] ; then
usePackageManager=1
echo "Package manager will be used for installs if possible"
echo "Package manager will be used for installs if possible" >> $glcLogFile
elif [ "$RESPONSE" = no ] ; then
usePackageManager=0
echo "Package manager will not be used for installs"
echo "Package manager will not be used for installs" >> $glcLogFile
else
echo "Please enter 'yes' or 'no'"
fi
done
else
usePackageManager=0
fi
# Binary, minimal, or full install?
installLevel=-2
while [ $installLevel -eq -2 ]
do
if [ -z ${cmdInstallLevel} ]; then
read -p "Binary, minimal, or full install?: " RESPONSE
else
RESPONSE=$cmdInstallLevel
fi
lcRESPONSE=${RESPONSE,,}
if [ "$lcRESPONSE" = binary ] ; then
installLevel=-1
echo "Binary install only (plus anything required to run the binary)"
echo "Binary install only (plus anything required to run the binary)" >> $glcLogFile
elif [ "$lcRESPONSE" = minimal ] ; then
installLevel=0
echo "Minimal install only (just enough to compile and run Galacticus)"
echo "Minimal install only (just enough to compile and run Galacticus)" >> $glcLogFile
elif [ "$lcRESPONSE" = full ] ; then
installLevel=1
echo "Full install"
echo "Full install" >> $glcLogFile
else
echo "Please enter 'binary', 'minimal' or 'full'"
fi
done
# Use multiple cores to compile.
coresAvailable=`grep -c ^processor /proc/cpuinfo`
coreCount=-1
while [ $coreCount -eq -1 ]
do
if [ -z ${cmdCores} ]; then
read -p "How many cores should I use when compiling? ($coresAvailable available): " RESPONSE
else
RESPONSE=$cmdCores
fi
if ! [[ "$RESPONSE" =~ ^[0-9]+$ ]] ; then
echo "Please enter an integer"
else
if [ "$RESPONSE" > 0 ] ; then
coreCount=$RESPONSE
echo "Will use $coreCount cores for compiling"
echo "Will use $coreCount cores for compiling" >> $glcLogFile
else
echo "Please enter a number greater than 0"
fi
fi
done
# Figure out which install options are available to us.
installViaYum=0
if [[ $installAsRoot -eq 1 && $usePackageManager -eq 1 ]]; then
if hash yum >& /dev/null; then
installViaYum=1
fi
fi
installViaApt=0
if [[ $installAsRoot -eq 1 && $usePackageManager -eq 1 ]]; then
if hash apt-get >& /dev/null; then
installViaApt=1
echo "$rootPassword" | eval $suCommand apt-get update $suClose
fi
fi
installViaCPAN=0
if hash perl >& /dev/null; then
perl -e "use CPAN" >& /dev/null
if [ $? -eq 0 ]; then
installViaCPAN=1
fi
fi
# Specify a list of paths to search for Fortran modules and libraries.
moduleDirs="-fintrinsic-modules-path $toolInstallPath/finclude -fintrinsic-modules-path $toolInstallPath/include -fintrinsic-modules-path $toolInstallPath/include/gfortran -fintrinsic-modules-path $toolInstallPath/lib/gfortran/modules -fintrinsic-modules-path /usr/local/finclude -fintrinsic-modules-path /usr/local/include/gfortran -fintrinsic-modules-path /usr/local/include -fintrinsic-modules-path /usr/lib/gfortran/modules -fintrinsic-modules-path /usr/include/gfortran -fintrinsic-modules-path /usr/include -fintrinsic-modules-path /usr/finclude -fintrinsic-modules-path /usr/lib64/gfortran/modules -L$toolInstallPath/lib -L$toolInstallPath/lib64"
# Specify a list of paths to search for library files.
libDirs="-L$toolInstallPath/lib -L$toolInstallPath/lib64"
# Define packages.
iPackage=-1
# sort
iPackage=$(expr $iPackage + 1)
package[$iPackage]="sort"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash sort && (echo 1.2.3 | sort --version-sort)"
getVersion[$iPackage]="versionString=(\`sort --version\`); echo \${versionString[3]}"
minVersion[$iPackage]="6.99"
maxVersion[$iPackage]="9.99"
yumInstall[$iPackage]="coreutils"
aptInstall[$iPackage]="coreutils"
sourceURL[$iPackage]="http://ftp.gnu.org/gnu/coreutils/coreutils-8.13.tar.gz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# cmp
iPackage=$(expr $iPackage + 1)
package[$iPackage]="cmp"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash cmp"
getVersion[$iPackage]="versionString=(\`cmp -v\`); echo \${versionString[3]}"
minVersion[$iPackage]="0.0"
maxVersion[$iPackage]="9.99"
yumInstall[$iPackage]="diffutils"
aptInstall[$iPackage]="diffutils"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# wget
iPackage=$(expr $iPackage + 1)
package[$iPackage]="wget"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash wget"
getVersion[$iPackage]="versionString=(\`wget -V\`); echo \${versionString[2]}"
minVersion[$iPackage]="0.0"
maxVersion[$iPackage]="9.99"
yumInstall[$iPackage]="wget"
aptInstall[$iPackage]="wget"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# which
iPackage=$(expr $iPackage + 1)
package[$iPackage]="which"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash which"
getVersion[$iPackage]="echo 1.0.0"
minVersion[$iPackage]="0.0"
maxVersion[$iPackage]="9.99"
yumInstall[$iPackage]="which"
aptInstall[$iPackage]="which"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# patch
iPackage=$(expr $iPackage + 1)
package[$iPackage]="patch"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash patch"
getVersion[$iPackage]="versionString=(\`patch -v\`); echo \${versionString[2]}"
minVersion[$iPackage]="0.0"
maxVersion[$iPackage]="9.99"
yumInstall[$iPackage]="patch"
aptInstall[$iPackage]="patch"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# sed
iPackage=$(expr $iPackage + 1)
package[$iPackage]="sed"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash sed"
getVersion[$iPackage]="versionString=(\`sed --version\`); echo \${versionString[3]}"
minVersion[$iPackage]="0.0"
maxVersion[$iPackage]="9.99"
yumInstall[$iPackage]="sed"
aptInstall[$iPackage]="sed"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# make
iPackage=$(expr $iPackage + 1)
package[$iPackage]="make"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash make"
getVersion[$iPackage]="versionString=(\`make -v\`); echo \${versionString[2]}"
minVersion[$iPackage]="0.0"
maxVersion[$iPackage]="9.99"
yumInstall[$iPackage]="make"
aptInstall[$iPackage]="make"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# grep
iPackage=$(expr $iPackage + 1)
package[$iPackage]="grep"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash grep"
getVersion[$iPackage]="versionString=(\`grep --version | sed -r s/\"[^0-9]*(([0-9]+\\.)+[0-9]+)\"/\"\\1\"/\`); echo \${versionString[0]}"
minVersion[$iPackage]="0.0"
maxVersion[$iPackage]="9.99"
yumInstall[$iPackage]="grep"
aptInstall[$iPackage]="grep"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# gcc (initial attempt - allow install via package manager only)
iPackage=$(expr $iPackage + 1)
iGCC=$iPackage
iGCCVMin="4.0.0"
package[$iPackage]="gcc"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash gcc"
getVersion[$iPackage]="versionString=(\`gcc --version\`); echo \${versionString[2]}"
minVersion[$iPackage]=$iGCCVMin
maxVersion[$iPackage]="19.9.9"
yumInstall[$iPackage]="gcc"
aptInstall[$iPackage]="gcc"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=1
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# g++ (initial attempt - allow install via package manager only)
iPackage=$(expr $iPackage + 1)
iGPP=$iPackage
iGPPVMin="4.0.0"
package[$iPackage]="g++"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash g++"
getVersion[$iPackage]="versionString=(\`g++ --version\`); echo \${versionString[2]}"
minVersion[$iPackage]=$iGPPVMin
maxVersion[$iPackage]="19.9.9"
yumInstall[$iPackage]="gcc-c++"
aptInstall[$iPackage]="g++"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=1
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# GFortran (initial attempt - allow install via package manager only)
iPackage=$(expr $iPackage + 1)
iFortran=$iPackage
iFortranVMin="10.1.0"
package[$iPackage]="gfortran"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash gfortran"
getVersion[$iPackage]="versionString=(\`gfortran --version\`); echo \${versionString[3]}"
minVersion[$iPackage]=$iFortranVMin
maxVersion[$iPackage]="19.9.9"
yumInstall[$iPackage]="gcc-gfortran"
aptInstall[$iPackage]="gfortran"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=1
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# expat
iPackage=$(expr $iPackage + 1)
package[$iPackage]="expat"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"#include <expat.h>\" > dummy.c; echo \"int main() {}\" >> dummy.c; gcc dummy.c $libDirs -lexpat"
getVersion[$iPackage]="echo 1.0.0"
minVersion[$iPackage]="0.0.0"
maxVersion[$iPackage]="99.99"
yumInstall[$iPackage]="expat-devel"
aptInstall[$iPackage]="libexpat1-dev"
sourceURL[$iPackage]="https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.gz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# Zlib
iPackage=$(expr $iPackage + 1)
iZLIB=$iPackage
package[$iPackage]="zlib"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"#include <zlib.h>\" > dummy.c; echo \"int main() {}\" >> dummy.c; gcc dummy.c $libDirs -lz"
getVersion[$iPackage]="echo \"#include <stdio.h>\" > dummy.c; echo \"#include <zlib.h>\" >> dummy.c; echo \"int main() {printf(ZLIB_VERSION);printf(\\\"\\\\n\\\");}\" >> dummy.c; gcc dummy.c $libDirs -lz ;./a.out"
minVersion[$iPackage]="0.0.0"
maxVersion[$iPackage]="9.9.9"
yumInstall[$iPackage]="zlib-devel"
aptInstall[$iPackage]="zlib1g-dev"
sourceURL[$iPackage]="http://zlib.net/zlib-1.3.1.tar.gz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# GMP (will only be installed if we need to compile any of the GNU Compiler Collection)
iPackage=$(expr $iPackage + 1)
iGMP=$iPackage
package[$iPackage]="gmp"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"#include <gmp.h>\" > dummy.c; echo \"int main() {}\" >> dummy.c; gcc dummy.c $libDirs -lgmp"
getVersion[$iPackage]="echo \"#include <stdio.h>\" > dummy.c; echo \"#include <gmp.h>\" >> dummy.c; echo \"int main() {printf(\\\"%d.%d.%d\\\\n\\\",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL);}\" >> dummy.c; gcc dummy.c $libDirs -lgmp; ./a.out"
minVersion[$iPackage]="4.3.2"
maxVersion[$iPackage]="99.99.99"
yumInstall[$iPackage]="gmp-devel"
aptInstall[$iPackage]="libgmp3-dev"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# MPFR (will only be installed if we need to compile any of the GNU Compiler Collection)
iPackage=$(expr $iPackage + 1)
iMPFR=$iPackage
package[$iPackage]="mpfr"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"#include <mpfr.h>\" > dummy.c; echo \"int main() {}\" >> dummy.c; gcc dummy.c $libDirs -lmpfr"
getVersion[$iPackage]="echo \"#include <stdio.h>\" > dummy.c; echo \"#include <mpfr.h>\" >> dummy.c; echo \"int main() {printf(\\\"%s\\\\n\\\",MPFR_VERSION_STRING);}\" >> dummy.c; gcc dummy.c $libDirs -lmpfr; ./a.out"
minVersion[$iPackage]="2.3.0999"
maxVersion[$iPackage]="99.99.99"
yumInstall[$iPackage]="mpfr-devel"
aptInstall[$iPackage]="libmpfr-dev"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# MPC (will only be installed if we need to compile any of the GNU Compiler Collection)
iPackage=$(expr $iPackage + 1)
iMPC=$iPackage
package[$iPackage]="mpc"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"#include <mpc.h>\" > dummy.c; echo \"int main() {}\" >> dummy.c; gcc dummy.c $libDirs -lmpc"
getVersion[$iPackage]="echo \"#include <stdio.h>\" > dummy.c; echo \"#include <mpc.h>\" >> dummy.c; echo \"int main() {printf(\\\"%s\\\\n\\\",MPC_VERSION_STRING);}\" >> dummy.c; gcc dummy.c $libDirs -lmpc; ./a.out"
minVersion[$iPackage]="1.0.0"
maxVersion[$iPackage]="99.99.99"
yumInstall[$iPackage]="libmpc-devel"
aptInstall[$iPackage]="libmpc-dev"
sourceURL[$iPackage]="null"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# bison
iPackage=$(expr $iPackage + 1)
iBison=$iPackage
package[$iPackage]="bison"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash bison"
getVersion[$iPackage]="echo 1.0.0"
minVersion[$iPackage]="0.9.9"
maxVersion[$iPackage]="99.99.99"
yumInstall[$iPackage]="bison"
aptInstall[$iPackage]="bison"
sourceURL[$iPackage]="http://ftp.gnu.org/gnu/bison/bison-3.0.1.tar.gz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# flex
iPackage=$(expr $iPackage + 1)
iFlex=$iPackage
package[$iPackage]="flex"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash flex"
getVersion[$iPackage]="echo 1.0.0"
minVersion[$iPackage]="0.9.9"
maxVersion[$iPackage]="99.99.99"
yumInstall[$iPackage]="flex"
aptInstall[$iPackage]="flex"
sourceURL[$iPackage]="http://downloads.sourceforge.net/project/flex/flex-2.5.37.tar.bz2"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
#! <workaround>
#! <replaced>makeTest[$iPackage]="make check"</replaced>
#! <description>test suite currently fails due to unsupported directive</description>
#! <url>http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00008.html</url>
#! </workaround>
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# gcc (second attempt - install from source)
iPackage=$(expr $iPackage + 1)
iGCCsource=$iPackage
package[$iPackage]="gcc"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash gcc"
getVersion[$iPackage]="versionString=(\`gcc --version\`); echo \${versionString[2]}"
minVersion[$iPackage]=$iGCCVMin
maxVersion[$iPackage]="19.9.9"
yumInstall[$iPackage]="null"
aptInstall[$iPackage]="null"
sourceURL[$iPackage]="git://gcc.gnu.org/git/gcc.git"
gitBranch[$iPackage]="releases/gcc-12"
buildEnvironment[$iPackage]="cd ../\$dirName; ./contrib/download_prerequisites; cd -"
buildInOwnDir[$iPackage]=1
configOptions[$iPackage]="--prefix=$toolInstallPath --enable-languages= --disable-multilib"
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# g++ (second attempt - install from source)
iPackage=$(expr $iPackage + 1)
iGPPsource=$iPackage
package[$iPackage]="g++"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash g++"
getVersion[$iPackage]="versionString=(\`g++ --version\`); echo \${versionString[2]}"
minVersion[$iPackage]=$iGPPVMin
maxVersion[$iPackage]="19.9.9"
yumInstall[$iPackage]="null"
aptInstall[$iPackage]="null"
sourceURL[$iPackage]="git://gcc.gnu.org/git/gcc.git"
gitBranch[$iPackage]="releases/gcc-12"
buildEnvironment[$iPackage]="cd ../\$dirName; ./contrib/download_prerequisites; cd -"
buildInOwnDir[$iPackage]=1
configOptions[$iPackage]="--prefix=$toolInstallPath --enable-languages= --disable-multilib"
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# GFortran (second attempt - install from source)
iPackage=$(expr $iPackage + 1)
iFortranSource=$iPackage
package[$iPackage]="gfortran"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash gfortran"
getVersion[$iPackage]="versionString=(\`gfortran --version\`); echo \${versionString[3]}"
minVersion[$iPackage]=$iFortranVMin
maxVersion[$iPackage]="19.9.9"
yumInstall[$iPackage]="null"
aptInstall[$iPackage]="null"
sourceURL[$iPackage]="git://gcc.gnu.org/git/gcc.git"
gitBranch[$iPackage]="releases/gcc-12"
buildEnvironment[$iPackage]="cd ../\$dirName; ./contrib/download_prerequisites; cd -"
buildInOwnDir[$iPackage]=1
configOptions[$iPackage]="--prefix=$toolInstallPath --enable-languages= --disable-multilib"
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# GSL
iPackage=$(expr $iPackage + 1)
iGSL=$iPackage
package[$iPackage]="gsl"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash gsl-config && hash gsl-histogram"
getVersion[$iPackage]="gsl-config --version"
minVersion[$iPackage]="1.15"
maxVersion[$iPackage]="2.7.1"
yumInstall[$iPackage]="gsl-devel"
aptInstall[$iPackage]="libgsl0-dev gsl-bin"
sourceURL[$iPackage]="http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gsl/gsl-2.6.tar.gz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# FoX
iPackage=$(expr $iPackage + 1)
package[$iPackage]="FoX"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"program dummy; end program\" > dummy.F90; gfortran dummy.F90 $moduleDirs $libDirs -lFoX_dom"
getVersion[$iPackage]="echo \"program test; use FoX_common; write (*,'(a)') FoX_version; end program\" > dummy.F90; gfortran dummy.F90 $moduleDirs $libDirs -lFoX_dom; ./a.out"
minVersion[$iPackage]="4.0.3.999"
maxVersion[$iPackage]="9.9.9"
yumInstall[$iPackage]="null"
aptInstall[$iPackage]="null"
sourceURL[$iPackage]="https://github.com/andreww/fox/archive/4.1.0.tar.gz"
buildEnvironment[$iPackage]="export FC=gfortran"
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# HDF5
iPackage=$(expr $iPackage + 1)
iHDF5=$iPackage
package[$iPackage]="hdf5"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"program test; use hdf5; end program test\" > dummy.F90; gfortran dummy.F90 $moduleDirs $libDirs -lhdf5"
getVersion[$iPackage]="echo \"#include <stdio.h>\" > dummy.c; echo \"#include <H5public.h>\" >> dummy.c; echo \"int main() {printf(\\\"%d.%d.%d.%d\\\\n\\\",H5_VERS_MAJOR,H5_VERS_MINOR,H5_VERS_RELEASE,H5_VERS_SUBRELEASE);}\" >> dummy.c; gcc dummy.c $libDirs -lhdf5 &> /dev/null;./a.out"
minVersion[$iPackage]="1.14.0"
maxVersion[$iPackage]="1.14.99"
yumInstall[$iPackage]="hdf5-devel"
aptInstall[$iPackage]="hdf5-tools"
sourceURL[$iPackage]="https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_5/downloads/hdf5-1.14.5.tar.gz"
buildEnvironment[$iPackage]="export F9X=gfortran"
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath --enable-fortran --enable-build-mode=production"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# FFTW3
iPackage=$(expr $iPackage + 1)
iFFTW3=$iPackage
package[$iPackage]="fftw3"
packageAtLevel[$iPackage]=1
testPresence[$iPackage]="hash fftw-wisdom"
getVersion[$iPackage]="versionString=(\`fftw-wisdom -V\`); echo \${versionString[5]}"
minVersion[$iPackage]="3.3.0"
maxVersion[$iPackage]="9.9.9"
yumInstall[$iPackage]="fftw3-devel"
aptInstall[$iPackage]="libfftw3-dev"
sourceURL[$iPackage]="http://www.fftw.org/fftw-3.3.4.tar.gz"
buildEnvironment[$iPackage]="export F9X=gfortran"
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]="check"
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# ANN
iPackage=$(expr $iPackage + 1)
iANN=$iPackage
package[$iPackage]="ann"
packageAtLevel[$iPackage]=1
testPresence[$iPackage]="echo \"int main() {}\" > dummy.c; gcc dummy.c $libDirs -lANN"
getVersion[$iPackage]="echo 1.1.2"
minVersion[$iPackage]="1.1.1"
maxVersion[$iPackage]="1.1.3"
yumInstall[$iPackage]="null"
aptInstall[$iPackage]="null"
sourceURL[$iPackage]="http://www.cs.umd.edu/~mount/ANN/Files/1.1.2/ann_1.1.2.tar.gz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]=""
makeInstall[$iPackage]=""
parallelBuild[$iPackage]=1
# QHull
iPackage=$(expr $iPackage + 1)
iQHull=$iPackage
package[$iPackage]="qhull"
packageAtLevel[$iPackage]=1
testPresence[$iPackage]="echo \"int main() {}\" > dummy.c; gcc dummy.c $libDirs -lqhull_r"
getVersion[$iPackage]="echo \"#include <stdio.h>\" > dummy.c; echo \"#include <libqhull_r/libqhull_r.h>\" >> dummy.c; echo \"int main() {printf(\\\"%s\n\\\",qh_version2);}\" >> dummy.c; g++ dummy.c -L$toolInstallPath/lib -L$toolInstallPath/lib64 -I$toolInstallPath/include -lqhull_r; ./a.out | awk '{print $2}'"
minVersion[$iPackage]="8.0.1"
maxVersion[$iPackage]="8.0.3"
yumInstall[$iPackage]="null"
aptInstall[$iPackage]="null"
sourceURL[$iPackage]="http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz"
buildEnvironment[$iPackage]="export PREFIX=$toolInstallPath"
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="skip"
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=1
# blas
iPackage=$(expr $iPackage + 1)
iBLAS=$iPackage
package[$iPackage]="blas"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"program dummy; end program\" > dummy.F90; gfortran dummy.F90 $moduleDirs $libDirs -lblas"
getVersion[$iPackage]="echo 1.0.0"
minVersion[$iPackage]="0.0.0"
maxVersion[$iPackage]="99.99"
yumInstall[$iPackage]=""
aptInstall[$iPackage]="libblas-dev"
sourceURL[$iPackage]="http://netlib.org/blas/blas.tgz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]=""
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# bzip2
iPackage=$(expr $iPackage + 1)
iBZIP2=$iPackage
package[$iPackage]="bzip2"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="echo \"int main() {}\" > dummy.c; gcc dummy.c $libDirs -lbz2"
getVersion[$iPackage]="echo 1.0.0"
minVersion[$iPackage]="0.9.9"
maxVersion[$iPackage]="1.0.1"
yumInstall[$iPackage]="bzip2 bzip2-devel bzip2-libs"
aptInstall[$iPackage]="bzip2 libbz2-dev"
sourceURL[$iPackage]="https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="skip"
makeTest[$iPackage]=""
makeInstall[$iPackage]="install PREFIX=$toolInstallPath"
parallelBuild[$iPackage]=0
# git
iPackage=$(expr $iPackage + 1)
iGIT=$iPackage
package[$iPackage]="git"
packageAtLevel[$iPackage]=0
testPresence[$iPackage]="hash git"
getVersion[$iPackage]="versionString=(\`git version\`); echo \${versionString[2]}"
minVersion[$iPackage]="2.0.0"
maxVersion[$iPackage]="9.9.9"
yumInstall[$iPackage]="git"
aptInstall[$iPackage]="git-all"
sourceURL[$iPackage]="https://github.com/git/git/archive/refs/tags/v2.40.0.tar.gz"
buildEnvironment[$iPackage]=""
buildInOwnDir[$iPackage]=0
configOptions[$iPackage]="--prefix=$toolInstallPath"
makeTest[$iPackage]=""
makeInstall[$iPackage]="install"
parallelBuild[$iPackage]=0
# Install packages.
echo "Checking for required tools and libraries..."
echo "Checking for required tools and libraries..." >> $glcLogFile
for (( i = 0 ; i < ${#package[@]} ; i++ ))
do
# Test if this module should be installed at this level.
if [ ${packageAtLevel[$i]} -le $installLevel ]; then
# Check if package is installed.
echo " Testing presence of ${package[$i]}" >> $glcLogFile
installPackage=1
eval ${testPresence[$i]} >>$glcLogFile 2>&1
if [ $? -eq 0 ]; then
# Check installed version.
echo " ${package[$i]} is present - testing version" >> $glcLogFile
version=`eval ${getVersion[$i]}` >>$glcLogFile 2>&1
echo " Found version $version of ${package[$i]}" >> $glcLogFile
testLow=`echo "$version test:${minVersion[$i]}:${maxVersion[$i]}" | sed s/:/\\\\n/g | sort --version-sort | head -1 | cut -d " " -f 2`
testHigh=`echo "$version test:${minVersion[$i]}:${maxVersion[$i]}" | sed s/:/\\\n/g | sort --version-sort | tail -1 | cut -d " " -f 2`
if [[ "$testLow" != "test" && "$testHigh" != "test" ]]; then
installPackage=0
fi
echo " Test results for ${package[$i]}: $testLow $testHigh" >> $glcLogFile
fi
# Check if installation is to be forced for this package.
test $(contains "$@" "--force-${package[$i]}") == "y"
if [ $? -eq 0 ]; then
installPackage=1
fi
# Install package if necessary.
if [ $installPackage -eq 0 ]; then
echo ${package[$i]} - found
echo ${package[$i]} - found >> $glcLogFile
else
echo ${package[$i]} - not found - will be installed