@@ -37,6 +37,16 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
37
37
# based on the version of the package (DMWM and DQMGUI).
38
38
source $SCRIPT_DIR /config.sh
39
39
40
+ # # Internal temporary paths
41
+ TMP_BASE_PATH=/tmp
42
+ ROOT_TMP_DIR=" ${TMP_BASE_PATH} /root"
43
+ ROOT_TMP_BUILD_DIR=" ${TMP_BASE_PATH} /root_build"
44
+ ROTOGLUP_TMP_DIR=" ${TMP_BASE_PATH} /rotoglup"
45
+ CLASSLIB_TMP_DIR=" ${TMP_BASE_PATH} /classlib-3.1.3"
46
+ DMWM_TMP_DIR=" ${TMP_BASE_PATH} /dmwm"
47
+ NUMERIC_TMP_DIR=" ${TMP_BASE_PATH} /numeric"
48
+ DQMGUI_TMP_DIR=" ${TMP_BASE_PATH} /dqmgui"
49
+
40
50
# Preliminary checks to do before installing the GUI
41
51
preliminary_checks () {
42
52
# Make sure we don't have superuser privileges
@@ -93,7 +103,7 @@ check_dependencies() {
93
103
# Instead of doing a 'yum list' per package, it may be faster to just
94
104
# ask all of them at once, and dump to file. Then grep the file.
95
105
echo -n " Getting system packages..."
96
- tmp_yum_list=/tmp/ yum_list.txt
106
+ tmp_yum_list=" ${TMP_BASE_PATH} / yum_list.txt"
97
107
eval " yum list ${required_packages[*]} " > $tmp_yum_list
98
108
echo " Done"
99
109
@@ -204,9 +214,8 @@ create_directories() {
204
214
}
205
215
206
216
install_rotoglup () {
207
- ROTOGLUP_TMP_DIR=/tmp/rotoglup
208
217
mkdir -p $ROTOGLUP_TMP_DIR
209
- tar -xzf " $SCRIPT_DIR /rotoglup/rotoglup.tar.gz" -C /tmp
218
+ tar -xzf " $SCRIPT_DIR /rotoglup/rotoglup.tar.gz" -C " $TMP_BASE_PATH "
210
219
211
220
cd $ROTOGLUP_TMP_DIR
212
221
# patch -p1 < $SCRIPT_DIR/rotoglup/patches/01.patch
@@ -232,9 +241,9 @@ compile_classlib() {
232
241
# Classlib is needed both as a shared object and for its header files for DQMGUI compilation.
233
242
install_classlib () {
234
243
# Temporary directory to extract to
235
- CLASSLIB_TMP_DIR=/tmp/classlib-3.1.3
244
+
236
245
mkdir -p $CLASSLIB_TMP_DIR
237
- tar -xf " $SCRIPT_DIR /classlib/classlib-3.1.3.tar.bz2" -C /tmp
246
+ tar -xf " $SCRIPT_DIR /classlib/classlib-3.1.3.tar.bz2" -C " ${TMP_BASE_PATH} "
238
247
239
248
# Apply code patches I found on cmsdist. The 7th one is ours, and has some extra needed fixes.
240
249
cd $CLASSLIB_TMP_DIR
@@ -268,15 +277,15 @@ install_classlib() {
268
277
269
278
install_boost_gil () {
270
279
mkdir -p $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/external/src/
271
- tar -xzf " $SCRIPT_DIR /boost_gil/boost_gil.tar.gz" -C /tmp
280
+ tar -xzf " $SCRIPT_DIR /boost_gil/boost_gil.tar.gz" -C " ${TMP_BASE_PATH} "
272
281
273
282
rm -rf " $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/external/src/boost" # Cleanup dir if exists
274
- mv /tmp/ boost_gil/include/boost " $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/external/src/boost"
283
+ mv " ${TMP_BASE_PATH} / boost_gil/include/boost" " $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/external/src/boost"
275
284
}
276
285
277
286
install_gil_numeric () {
278
- NUMERIC_TMP_DIR=/tmp/numeric
279
- tar -xzf " $SCRIPT_DIR /numeric/numeric.tar.gz" -C /tmp
287
+
288
+ tar -xzf " $SCRIPT_DIR /numeric/numeric.tar.gz" -C " ${TMP_BASE_PATH} "
280
289
mkdir -p " $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/external/src/boost/gil/extension/"
281
290
282
291
rm -rf " $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/external/src/boost/gil/extension/numeric" # Cleanup dir if exists
@@ -285,9 +294,9 @@ install_gil_numeric() {
285
294
286
295
install_dmwm () {
287
296
# Temporary directory to clone DMWM deployment scripts into
288
- DMWM_TMP_DIR=/tmp/dmwm
297
+
289
298
mkdir -p $DMWM_TMP_DIR
290
- tar -xzf " $SCRIPT_DIR /dmwm/dmwm.tar.gz" -C /tmp
299
+ tar -xzf " $SCRIPT_DIR /dmwm/dmwm.tar.gz" -C " ${TMP_BASE_PATH} "
291
300
# Move dqmgui-related scripts from DMWM to the config folder
292
301
rm -rf " $INSTALLATION_DIR /$DMWM_GIT_TAG /config/dqmgui" # Cleanup dir if exists
293
302
mv " $DMWM_TMP_DIR /dqmgui" " $INSTALLATION_DIR /$DMWM_GIT_TAG /config/dqmgui"
@@ -351,7 +360,7 @@ _create_python_venv() {
351
360
mkdir -p " $python_venv_dir "
352
361
353
362
# Extract the downloaded python packages
354
- tar -xzf " $SCRIPT_DIR /pypi/pypi.tar.gz" -C /tmp
363
+ tar -xzf " $SCRIPT_DIR /pypi/pypi.tar.gz" -C " ${TMP_BASE_PATH} "
355
364
echo -n " INFO: Creating virtual environment at $python_venv_dir "
356
365
$python_exe -m venv " $python_venv_dir "
357
366
@@ -366,21 +375,21 @@ _create_python_venv() {
366
375
export PYTHON_LIB_DIR_NAME
367
376
368
377
# Install pip
369
- unzip -u /tmp/ pip/pip* whl -d /tmp/ pip/pip
378
+ unzip -u ${TMP_BASE_PATH} / pip/pip* whl -d " ${TMP_BASE_PATH} / pip/pip"
370
379
if [ -d " $python_venv_dir /$PYTHON_LIB_DIR_NAME /pip" ]; then
371
380
rm -rf " $python_venv_dir /$PYTHON_LIB_DIR_NAME /pip"
372
381
fi
373
382
374
383
# pipipipi
375
- mv /tmp/ pip/pip/pip " $python_venv_dir /$PYTHON_LIB_DIR_NAME /pip"
376
- rm -rf /tmp/ pip/pip
384
+ mv " ${TMP_BASE_PATH} / pip/pip/pip" " $python_venv_dir /$PYTHON_LIB_DIR_NAME /pip"
385
+ rm -rf " ${TMP_BASE_PATH} / pip/pip"
377
386
378
387
# Install wheels
379
- eval " ${python_venv_exe} -m pip install --no-index --find-links /tmp/ pip /tmp /pip/*"
388
+ eval " ${python_venv_exe} -m pip install --no-index --find-links ${TMP_BASE_PATH} / pip ${TMP_BASE_PATH} /pip/*"
380
389
eval " ${python_venv_exe} -m pip install $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/cms/dqmgui/$DQMGUI_GIT_TAG /128"
381
390
382
391
cd " $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/cms/dqmgui/$DQMGUI_GIT_TAG /128/"
383
- rm -rf /tmp/ pip
392
+ rm -rf " ${TMP_BASE_PATH} / pip"
384
393
echo " Done"
385
394
}
386
395
@@ -409,10 +418,10 @@ compile_dqmgui() {
409
418
fi
410
419
411
420
# python3-config is not always in a predictable place
412
- python_config_cmd=$( which python3 -config) || python_config_cmd=$( find /usr/bin -name " python3*-config" | head -1)
421
+ python_config_cmd=$( which python ${PYTHON_VERSION} -config) || python_config_cmd=$( find /usr/bin -name " python3*-config" | head -1)
413
422
414
423
if [ -z " $python_config_cmd " ]; then
415
- echo " ERROR: Could not find python3 -config"
424
+ echo " ERROR: Could not find python ${PYTHON_VERSION} -config"
416
425
exit 1
417
426
fi
418
427
# The actual build command. Uses the makefile in the DQMGUI's repo.
@@ -448,8 +457,7 @@ install_dqmgui() {
448
457
source " $INSTALLATION_DIR /root/bin/thisroot.sh"
449
458
450
459
# Temporary directory to clone GUI into
451
- DQMGUI_TMP_DIR=/tmp/dqmgui
452
- tar -xzf " $SCRIPT_DIR /dqmgui/dqmgui.tar.gz" -C /tmp
460
+ tar -xzf " $SCRIPT_DIR /dqmgui/dqmgui.tar.gz" -C " ${TMP_BASE_PATH} "
453
461
454
462
# Move dqmgui source and bin files to appropriate directory
455
463
if [ -d " $INSTALLATION_DIR /$DMWM_GIT_TAG /sw/cms/dqmgui/$DQMGUI_GIT_TAG " ]; then
@@ -511,7 +519,7 @@ install_jsroot() {
511
519
512
520
# Extract the ROOT tar to a tmp folder for compilation
513
521
install_root () {
514
- tar -xzf " $SCRIPT_DIR /root/root.tar.gz" -C /tmp
522
+ tar -xzf " $SCRIPT_DIR /root/root.tar.gz" -C " ${TMP_BASE_PATH} "
515
523
# if [ -d $INSTALLATION_DIR/$DMWM_GIT_TAG/sw/external/root ]; then
516
524
# rm -rf $INSTALLATION_DIR/$DMWM_GIT_TAG/sw/external/src/root
517
525
# fi
@@ -520,8 +528,6 @@ install_root() {
520
528
}
521
529
522
530
compile_root () {
523
- ROOT_TMP_DIR=/tmp/root
524
- ROOT_TMP_BUILD_DIR=/tmp/root_build
525
531
if [ ! -d $ROOT_TMP_DIR ]; then
526
532
echo " ERROR: ROOT source was not found in $ROOT_TMP_DIR "
527
533
exit 1
@@ -533,12 +539,21 @@ compile_root() {
533
539
fi
534
540
mkdir -p $ROOT_TMP_BUILD_DIR
535
541
cd $ROOT_TMP_BUILD_DIR
536
- cmake -DCMAKE_INSTALL_PREFIX=$ROOT_INSTALLATION_DIR $ROOT_TMP_DIR -DPython3_ROOT_DIR=$( which python3 ) -Dtesting=OFF -Dbuiltin_gtest=OFF
542
+ cmake -DCMAKE_INSTALL_PREFIX=$ROOT_INSTALLATION_DIR $ROOT_TMP_DIR -DPython3_ROOT_DIR=" $( which python ${PYTHON_VERSION} ) " -Dtesting=OFF -Dbuiltin_gtest=OFF
537
543
cmake --build . --target install -j $( nproc)
538
544
cd $INSTALLATION_DIR
539
545
rm -rf $ROOT_TMP_DIR $ROOT_TMP_BUILD_DIR
540
546
}
541
547
548
+ # Cleanup temporary directories, remove cronjobs
549
+ function _cleanup() {
550
+ rm -rf $ROOT_TMP_DIR $ROOT_TMP_BUILD_DIR $ROTOGLUP_TMP_DIR $CLASSLIB_TMP_DIR $DMWM_TMP_DIR $NUMERIC_TMP_DIR $DQMGUI_TMP_DIR
551
+ clean_crontab
552
+ clean_acrontab
553
+ }
554
+
555
+ trap _cleanup SIGINT
556
+
542
557
# ## Main script ###
543
558
544
559
# Declare each step of the installation procedure here. Steps
0 commit comments