This repository has been archived by the owner on Jan 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetupMachine.sh
executable file
·333 lines (294 loc) · 9.16 KB
/
setupMachine.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
#!/bin/bash
## @file setupMachine.sh
## @author CMS GEM DAQ Project
## @copyright MIT
## @version 1.0
## @brief Script to facilitate the setup of new GEM DAQ machines.
## @defgroup MachineSetup Machine Setup
## @brief These functions directly relate to the setting up of new DAQ PCs.
## @details The linked functions perform all the various steps.
##
## @note Should be run on a compatible architecture (REHL/Centos based).
##
## @par Usage @c setupMachine.sh @c -h
##
## The main entry point is provided in the function @ref setup_machine.
## @fn cleanup()
## @brief Performs cleanup of the actions taken when running the script
## @ingroup MachineSetup
## @details Called in @c trap on
## @li @c EXIT
## @li @c SIGQUIT
## @li @c SIGINT
## @li @c SIGTERM
## @li @c SIGSEGV
cleanup() {
}
trap cleanup EXIT SIGQUIT SIGINT SIGTERM SIGSEGV
# Imports
. utils/helpers.sh
. utils/xdaq.sh
. utils/cactus.sh
. utils/utca.sh
. utils/extras.sh
. utils/devtools.sh
. utils/accounts.sh
. utils/networking.sh
. utils/xilinx.sh
export arch=`uname -i`
export osver=`expr $(uname -r) : '.*el\([0-9]\)'`
export ostype=centos
export osrel=cc${osver}
if [ "${osver}" = "6" ]
then
ostype=slc
osrel=${ostype}${osver}
fi
## @fn usage()
## @brief Usage function for @ref setup_machine
## @ingroup MachineSetup
usage() {
cat <<EOF
Usage: $0 [options]
Options:
-x install xdaq software
-c Install cactus tools (uhal and amc13)
-m Install other miscellaneous packages (for development machines)
-s Install UW system manager
-r Install ROOT (from repository)
-p Install additional python versions
-d Install developer tools
-n Setup mounting of NAS
-C Set up CTP7 connections
-M Install Mellanox 10GbE drivers for uFEDKIT
-N Set up network interfaces
-P Install/update xpci drivers
-R Get repository files
-U Create common users and groups
-z Install Xilinx USB drivers
-v Install Xilinx Vivado
-e Install Xilinx ISE
-l Install Xilinx LabTools
-u <file> Add accounts of NICE users (specified in file)
-h Print this help menu
The following options group common actions into a single option, assuming defaults for the detected system, override with appropriate options:
-A Setup new system with defaults for DAQ with accounts (implies -IUN)
-D Install extra drivers (implies -MP)
-I Install only software (implies -xcmrs)
-X Install Xilinx tooling (implies -zvle)
Note:
Full support is only currently provided for CC7 (and soon C8)
Examples:
Set up newly installed machine and add CERN NICE users: $0 -Au
Set up newly installed machine and add uFEDKIT support: $0 -AM
Plese report bugs to:
https://github.com/cms-gem-daq-project/cmsgemos
EOF
exit 1
}
## @fn setup_machine()
## @brief Runs the machine setup
## @ingroup MachineSetup
## @details The available flags are:
##
## These flags aggregate some of the individual options for ease of use
## @li @c -A Setup new system with defaults for DAQ with accounts (implies @c -IUN)
## @li @c -D Install extra drivers (implies @c -MP)
## @li @c -I Install only software (implies @c -xcmrs)
## @li @c -X Install Xilinx tooling (implies @c -zvle)
##
## Individual options
## @li @c -x install @c xdaq software with @ref install_xdaq
## @li @c -c Install cactus tools (@c uhal and @c amc13) with @ref install_cactus
## @li @c -m Install other miscellaneous packages (for development machines) with @ref install_misc_rpms
## @li @c -s Install UW system manager with @ref install_sysmgr
## @li @c -r Install ROOT (from repository) with @ref install_root
## @li @c -p Install additional @c python versions with @ref install_python
## @li @c -d Install developer tools with @ref install_developer_tools
## @li @c -n Setup mounting of NAS with @ref setup_nas
## @li @c -C Set up CTP7 connections with @ref connect_ctp7s
## @li @c -M Install Mellanox 10GbE drivers for uFEDKITs with @ref install_mellanox_driver
## @li @c -N Set up network interfaces with @ref setup_network
## @li @c -P Install/update @c xpci drivers for uFEDKITs with @ref update_xpci_driver
## @li @c -R Get repository files with @ref get_xdaq_repo, with @ref get_cactus_repos, with @ref get_gemos_repo
## @li @c -U Create common users and groups with @ref create_accounts
## @li @c -z Install Xilinx USB cable drivers with @ref install_usb_cable_driver
## @li @c -v Install Xilinx Vivado with @ref install_vivado
## @li @c -e Install Xilinx ISE with @ref install_ise
## @li @c -l Install Xilinx LabTools with @ref install_labtools
## @li @c -u @c file Add accounts of NICE users (specified in @c file) with @ref add_users
## @li @c -h Print this help menu
##
setup_machine() {
declare -r baseopts="hxcmsrpdnCMNPRUu"
declare -r groupopts="ADIX"
declare -r xilopts="zvle"
declare -r allopts=${baseopts}${groupopts}${xilopts}
while getopts "${allopts}" opt
do
case $opt in
A)
printf "\033[1;36m %s \n\033[0m" "Doing all steps necessary for new machine"
GET_REPO_FILES=1
INSTALL_XDAQ=1
INSTALL_CACTUS=1
INSTALL_ROOT=1
INSTALL_SYSMGR=1
INSTALL_MISC_RPMS=1
CREATE_ACCOUNTS=1
SETUP_NETWORK=1
;;
I)
print "\e[48;5;221m\e[38;5;15m"
print "\e[33;5;0m\e[38;5;221m"
printf "\033[1;36m %s \n\033[0m" "Installing necessary packages"
GET_REPO_FILES=1
INSTALL_XDAQ=1
INSTALL_CACTUS=1
INSTALL_ROOT=1
INSTALL_SYSMGR=1
INSTALL_MISC_RPMS=1
;;
D)
printf "\033[1;36m %s \n\033[0m" "Installing optional drivers"
INSTALL_MELLANOX_DRIVER=1
UPDATE_XPCI_DRIVER=1
INSTALL_USB_DRIVER=1
;;
X)
printf "\033[1;36m %s \n\033[0m" "Installing optional Xilinx tooling"
INSTALL_USB_DRIVER=1
INSTALL_VIVADO=1
INSTALL_ISE=1
INSTALL_LABTOOLS=1
;;
x)
INSTALL_XDAQ=1 ;;
c)
INSTALL_CACTUS=1 ;;
m)
INSTALL_MISC_RPMS=1 ;;
s)
INSTALL_SYSMGR=1 ;;
r)
INSTALL_ROOT=1 ;;
p)
INSTALL_PYTHON=1 ;;
d)
INSTALL_DEVELOPER_TOOLS=1 ;;
n)
SETUP_NAS=1 ;;
C)
CONNECT_CTP7S=1 ;;
M)
INSTALL_MELLANOX_DRIVER=1 ;;
N)
SETUP_NETWORK=1 ;;
R)
GET_REPO_FILES=1 ;;
P)
UPDATE_XPCI_DRIVER=1 ;;
U)
CREATE_ACCOUNTS=1 ;;
z)
INSTALL_USB_DRIVER=1 ;;
v)
INSTALL_VIVADO=1 ;;
e)
INSTALL_ISE=1 ;;
l)
INSTALL_LABTOOLS=1 ;;
u)
ADD_USERS=1 ;;
h)
echo >&2 ; usage ; exit 1 ;;
\?)
printf "\033[1;31m %s \n\033[0m" "Invalid option: -$OPTARG" >&2 ; usage ; exit 1 ;;
[?])
echo >&2 ; usage ; exit 1 ;;
esac
done
## execute the specified steps
if [ "${GET_REPO_FILES}" = "1" ]
then
read -r -p $'\e[1;34mPlease specify desired xDAQ version:\033[0m ' xdaqver
get_xdaq_repo ${xdaqver} ${osrel}
get_cactus_repo ${osrel}
get_gemos_repo ${osrel}
fi
if [ "${INSTALL_XDAQ}" = "1" ]
then
read -r -p $'\e[1;34mPlease specify desired xDAQ version:\033[0m ' xdaqver
install_xdaq ${xdaqver} ${osrel}
fi
if [ "${INSTALL_CACTUS}" = "1" ]
then
install_cactus ${ostype}${osver}
fi
if [ "${INSTALL_MISC_RPMS}" = "1" ]
then
install_misc_rpms
fi
if [ "${INSTALL_SYSMGR}" = "1" ]
then
install_sysmgr
fi
if [ "${INSTALL_ROOT}" = "1" ]
then
install_root
fi
if [ "${INSTALL_PYTHON}" = "1" ]
then
install_python
fi
if [ "${INSTALL_DEVELOPER_TOOLS}" = "1" ]
then
install_developer_tools
fi
if [ "${SETUP_NAS}" = "1" ]
then
setup_nas
fi
if [ "${SETUP_NETWORK}" = "1" ]
then
setup_network
fi
if [ "${CONNECT_CTP7S}" = "1" ]
then
connect_ctp7s
fi
if [ "${INSTALL_MELLANOX_DRIVER}" = "1" ]
then
install_mellanox_driver
fi
if [ "${UPDATE_XPCI_DRIVER}" = "1" ]
then
update_xpci_driver
fi
if [ "${CREATE_ACCOUNTS}" = "1" ]
then
create_accounts
fi
if [ "${ADD_USERS}" = "1" ]
then
add_users
fi
if [ "${INSTALL_USB_DRIVER}" = "1" ]
then
install_usb_cable_driver
fi
if [ "${INSTALL_VIVADO}" = "1" ]
then
install_vivado
fi
if [ "${INSTALL_ISE}" = "1" ]
then
install_ise
fi
if [ "${INSTALL_LABTOOLS}" = "1" ]
then
install_labtools
fi
printf "\033[1;32m %s \n\033[0m" "Your machine should now be configured!"
}
(setup_machine)