-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathRunme
executable file
·95 lines (80 loc) · 3.06 KB
/
Runme
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
#!/bin/bash
# Initialization script for autowrfchem. Run this to set up for automatic
# running of WRF-Chem
cd `dirname $0`
mydir=`pwd -P`
cd ..
# Link the main executable up one directory to make it obvious which command to call
ln -s "$mydir/autowrfchem_main" autowrfchem
# Check if all utilities needed are installed
doexit=false
which python >& /dev/null
if [ $? -ne 0 ]; then
echo "python is not on your path. This is necessary to use autowrfchem."
doexit=true
fi
which perl >& /dev/null
if [ $? -ne 0 ]; then
echo "perl is not on your path. This is necessary to use autowrfchem."
doexit=true
fi
which git >& /dev/null
if [ $? -ne 0 ]; then
echo "git is not available on this system."
doexit=true
fi
if $doexit; then
exit 1
fi
rootrepo="https://github.com/CohenBerkeleyLab"
# These two arrays will be used in selecting the WPS version. The first is used to print out
# the menu options. The second should correspond to the remote branch name containing that version
# such that running "git checkout origin/${branchname[$sel]}" would checkout that branch.
# These are separated to allow more flexibility in naming the branches (in case there's a
# mistake in the naming) but the branches should REALLY be named with the version number for
# consistency. Note that the order of the two must be the same.
wpsmenu=("v3.5.1" "v3.6")
branchname=("v3.5.1" "v3.6")
# Determine if it needs to clone anything (WPS, NEI, MEGAN, MOZBC). WPS will need to know
# what version to clone (maintained as different branches in the WPS repo)
if [ ! -e WPS -o ! -e NEI -o ! -e MEGAN -o ! -e MOZBC ]; then
echo "AUTOWRFCHEM expects the directories WPS, NEI, MEGAN, and MOZBC to be siblings to it."
echo "One or more of these is missing; would you like to clone the missing ones automatically?"
read -p "Enter y or n: " userans
if [ "$userans" == "y" -o "$userans" == "Y" ]; then
if [ ! -e WPS ]; then
git clone ${rootrepo}/WPS.git WPS
# Have the user choose the WPS version
cd WPS
echo "Choose the WPS version:"
i=0
for vers in "${wpsmenu[@]}"; do
i=$((i+1))
echo " $i: $vers"
done
while true; do
echo -n "Enter choice (1-${i}): "
read userin
if [ $userin -ge 1 -a $userin -le $i ]; then break; fi
done
sel=$((userin-1))
git checkout -b ${branchname[$sel]} origin/${branchname[$sel]}
cd ..
fi
if [ ! -e NEI ]; then
git clone ${rootrepo}/NEI.git NEI
fi
if [ ! -e MEGAN ]; then
git clone ${rootrepo}/MEGAN.git MEGAN
fi
if [ ! -e MOZBC ]; then
git clone ${rootrepo}/MOZBC.git MOZBC
fi
else
echo "You have chosen not to clone the various components. They must still be provided for autowrfchem to work."
fi
fi
if [ ! -e WRFV3 ]; then
echo "Remember, WRFV3 must be a directory at this level, and it must contain a run subdirectory."
fi
exit 0