-
Notifications
You must be signed in to change notification settings - Fork 6
/
step1.sh
executable file
·83 lines (77 loc) · 1.95 KB
/
step1.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
#!/bin/bash
echo "Starting job on "`date` # to display the start date
echo "Running on "`uname -a` # to display the machine where the job is running
echo "System release "`cat /etc/redhat-release` # and the system release
echo "CMSSW on Condor"
# check arguments
export CMSSWVER=""
export CMSSWLOC=""
export CMSSWXRD=""
export OPTIND=1
while [[ $OPTIND -le $# ]]; do
# getopts in silent mode, don't exit on errors
OPTOLD=$OPTIND
getopts ":C:L:X:" opt
case "$opt" in
C) export CMSSWVER=$OPTARG
;;
L) export CMSSWLOC=$OPTARG
;;
X) export CMSSWXRD=$OPTARG
;;
# keep going if getopts had an error, but make sure not to skip anything
\? | :) OPTIND=$((OPTOLD+1))
;;
esac
done
echo ""
echo "parameter set:"
echo "CMSSWVER: $CMSSWVER"
if [ -n "$CMSSWLOC" ]; then
echo "CMSSWLOC: $CMSSWLOC"
fi
if [ -n "$CMSSWXRD" ]; then
echo "CMSSWXRD: $CMSSWXRD"
fi
echo ""
# to get condor-chirp from CMSSW
export PATH="/usr/libexec/condor:$PATH"
# environment setup
source /cvmfs/cms.cern.ch/cmsset_default.sh
# three ways to get CMSSW: tarball transferred by condor, tarball transferred by xrdcp (address provided), new release (SCRAM_ARCH provided)
if [[ "$CMSSWXRD" == root:* ]]; then
echo "Getting CMSSW via xrdcp"
xrdcp -f ${CMSSWXRD}/${CMSSWVER}.tar.gz .
XRDEXIT=$?
if [[ $XRDEXIT -ne 0 ]]; then
echo "exit code $XRDEXIT, failure in xrdcp"
exit $XRDEXIT
fi
elif [ -n "$CMSSWLOC" ]; then
echo "Getting CMSSW via cmsrel"
export SCRAM_ARCH=${CMSSWLOC}
fi
# use a tarball if we have it, otherwise make a new release area
set -e
if [ -e ${CMSSWVER}.tar.gz ]; then
# workaround
if [ -n "$CMSSWLOC" ]; then
mkdir tmp
tar -xzf ${CMSSWVER}.tar.gz -C tmp
scram project ${CMSSWVER}
# omits hidden dirs such as .SCRAM
cp -r tmp/${CMSSWVER}/* ${CMSSWVER}/
cd ${CMSSWVER}
else
tar -xzf ${CMSSWVER}.tar.gz
cd ${CMSSWVER}
scram b ProjectRename
scram b ExternalLinks
fi
else
scram project ${CMSSWVER}
cd ${CMSSWVER}
fi
# cmsenv
eval `scramv1 runtime -sh`
set +e