-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript_args.sh
executable file
·148 lines (137 loc) · 3.52 KB
/
script_args.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
#!/bin/bash
HELP="NO"
CHECKOUT="HEPFORGE" # Alternate option is "GITHUB"
REPO="GENIEMC" # GitHub user account
TAG="R-2_8_4" # SVN Branch
PYTHIAVER=6 # Must be 6 or 8
MAKE=gmake # May prefer "make" on Ubuntu
MAKENICE=0 # Run make under nice if == 1
ROOTTAG="v5-34-18" #
FORCEBUILD="NO" # " -f" will archive existing packages and rebuild
HTTPSCHECKOUT=0 # use https checkout if non-zero (otherwise ssh)
# Print the help menu and then exit.
help()
{
echo ""
echo ""
echo "Welcome to rub_the_lamp. This script will build the 3rd party support"
echo "packages for GENIE and then build GENIE itself. There are MANDATORY"
echo "options you must supply."
echo ""
echo "Usage: ./rub_the_lamp.sh -<flag>"
echo " -h / --help : Help"
echo " -g / --github : Check out GENIE code from GitHub"
echo " -f / --forge : Check out GENIE code from HepForge"
echo " (DEFAULT)"
echo " -r / --repo : Specify the GitHub repo"
echo " (default == GENIEMC)"
echo " -t / --tag : Specify the HepForge SVN tag"
echo " (default == R-2_8_4)"
echo " -p / --pythia : Pythia version (6 or 8)"
echo " (default == 6)"
echo " -m / --make : Use make instead of gmake"
echo " (default == use gmake)"
echo " -n / --nice : Run make under nice"
echo " (default == normal make)"
echo " -o / --root : ROOT tag version"
echo " (default == v5-34-18)"
echo " -s / --https : Use HTTPS checkout from GitHub"
echo " (default is ssh)"
echo " -c / --force : Archive existing packages and rebuild"
echo " (default is to keep the existing area)"
echo ""
echo ""
exit 1
}
#
# Did the user supply any arguments? If no, print help and exit.
#
if [[ $# < 1 ]]; then
HELP="YES"
fi
echo ""
echo "Letting GENIE out of the bottle..."
#
# Parse the command line flags.
#
while [[ $# > 0 ]]
do
key="$1"
shift
case $key in
-h|--help)
HELP="YES"
;;
-g|--github)
CHECKOUT="GITHUB"
;;
-f|--forge)
CHECKOUT="HEPFORGE"
;;
-r|--repo)
REPO="$1"
CHECKOUT="GITHUB"
shift
;;
-t|--tag)
TAG="$1"
CHECKOUT="HEPFORGE"
shift
;;
-p|--pythia)
PYTHIAVER="$1"
shift
;;
-m|--make)
MAKE=make
;;
-n|--nice)
MAKENICE=1
;;
-o|root)
ROOTTAG="$1"
shift
;;
-s|--https)
HTTPSCHECKOUT=1
;;
-c|--force)
FORCEBUILD="YES"
;;
*) # Unknown option
;;
esac
done
if [[ $HELP == "YES" ]]; then
help
fi
#
# Show the selected options.
#
echo ""
echo "Options set: "
echo "------------ "
echo " Checkout = $CHECKOUT"
if [[ $CHECKOUT == "HEPFORGE" ]]; then
echo " Tag = $TAG"
elif [[ $CHECKOUT == "GITHUB" ]]; then
echo " Repo = $REPO"
echo " HTTPS Checkout = $HTTPSCHECKOUT"
else
echo "Bad checkout option!"
exit 1
fi
echo " Pythia version = $PYTHIAVER"
echo " Make = $MAKE"
echo " Make Nice = $MAKENICE"
echo " ROOT tag = $ROOTTAG"
echo " Force build = $FORCEBUILD"
#
# Pause here to verify selection?
#
echo ""
echo "Press enter to continue or enter any character to quit."
read CONTINUE
if [[ $CONTINUE != "" ]]; then
echo " Halting!"
fi