ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/configure_for_cvs
Revision: 1.1.2.1.2.2
Committed: Mon Aug 28 16:14:39 2006 UTC (18 years, 8 months ago) by fanzago
Branch: CRAB_BOSS4_v1
Changes since 1.1.2.1.2.1: +28 -6 lines
Log Message:
added DBS and DLS API installation

File Contents

# User Rev Content
1 fanzago 1.1.2.1 #! /bin/sh
2     #
3     # Installation script for Crab
4     #
5    
6     # Subdir structure:
7     # Boss/...
8     # python/...
9     # script/...
10     # DBSAPI
11     # DLSAPI
12     # PsetCode
13     #
14    
15     # TopDir = CRAB/python
16     TopDir=`\pwd`
17    
18     #############################################
19     ######## BOSS CONFIGURATION #################
20     #############################################
21 fanzago 1.1.2.1.2.1
22     ## to change the BOSSVER value with the BOSS version you want to use.
23     ## Check if the version of BOSS you want to use exists on BOSS homepage ...
24     BOSSVER=4_0_0
25    
26 fanzago 1.1.2.1 BACKEND=SQLite
27    
28     function configureBoss {
29     ## unpack and configure Boss
30    
31     if [ ! -d ../Boss ] ;then
32     mkdir ../Boss
33     result=$?
34     if [ $result != 0 ] ;then
35     echo "problem with ../Boss dir creation"
36     exit
37     fi
38     else
39     echo "directory ../Boss exists"
40     fi
41    
42     if [ ! -s ../Boss/boss-v${BOSSVER}-bin.tar.gz ] ;then
43     cd ../Boss
44 fanzago 1.1.2.1.2.1 # WARNING:
45     # wget http://boss.bo.infn.it/boss-v${BOSSVER}-bin.tar.gz
46     cp /afs/cern.ch/user/f/fanzago/public/boss-v${BOSSVER}-bin.tar.gz .
47 fanzago 1.1.2.1 result=$?
48     if [ $result != 0 ] ;then
49     echo "problem with boss tgz download"
50     exit
51     fi
52     else
53     echo "boss-v${BOSSVER}-bin.tar.gz already downloaded"
54     fi
55    
56     cd ../Boss
57     if [ ! -d BOSS ] ;then
58     if [ ! -d boss-v${BOSSVER} ] ;then
59     echo "unpacking BOSS distribution ${BOSSVER}"
60     tar xzf boss-v${BOSSVER}-bin.tar.gz
61     fi
62     if [ -d boss-v${BOSSVER} ] ;then
63     mv boss-v${BOSSVER} BOSS
64     ls
65     fi
66    
67     cd BOSS
68    
69     echo "Creating Env. files"
70     source install.sh
71     echo "Creating ./BossConfig.clad"
72     cat > ./BossConfig.clad <<EOF
73     # This is the BOSS configuration file
74    
75     [
76     # BOSS temporary directory (where files are extracted from DB)
77     BOSS_TMP_DIR = "/tmp";
78    
79     # BOSS update interval
80     BOSS_MIN_UPD_INT = 30; # at most one upd. every BOSS_MIN_UPD_INT sec.
81     BOSS_MAX_UPD_INT = 180; # at least one upd. every BOSS_MAX_UPD_INT sec.
82    
83     # Maximum retries after post-process finishes before killing RTUpdator
84     # (waits BOSS_UPD_INTERVAL*BOSS_MAX_RETRY seconds)
85     BOSS_MAX_RETRY = 3;
86    
87     # Boss Database Backend
88     DB_BACKEND = "${BACKEND}";
89    
90     # Info sent also to Monalisa (if empty not enabled)
91     ML_URL = "";
92     ]
93     EOF
94    
95     echo "Setting environment"
96 fanzago 1.1.2.1.2.1 source bossenv.sh
97     which boss
98 fanzago 1.1.2.1 else
99     echo "../Boss/BOSS already exists"
100 fanzago 1.1.2.1.2.1 which boss
101     result=$?
102     if [ $result != 0 ] ;then
103     source ../Boss/BOSS/bossenv.sh
104     fi
105     echo "boss: "
106     which boss
107 fanzago 1.1.2.1 fi
108    
109     }
110    
111     function configureCrab {
112     ## prapare the crab env
113     cd $TopDir
114    
115     # sh style
116     cat > crab.sh <<EOF
117     #! /bin/sh
118     # CRAB related Stuff
119     export CRABDIR=$TopDir/..
120     export CRABSCRIPT=\${CRABDIR}/script
121    
122     CRABPATH=\${CRABDIR}/python
123     CRABDLSAPIPATH=\${CRABDIR}/DLSAPI
124     export CRABPYTHON=\${CRABDIR}/python
125     export CRABDBSAPIPYTHON=\${CRABDIR}/DBSAPI
126     export CRABDLSAPIPYTHON=\${CRABDIR}/DLSAPI
127     export CRABPSETPYTHON=\${CRABDIR}/PsetCode
128    
129     if [ -z "\$PATH" ]; then
130     export PATH=\${CRABPATH}:\${CRABDLSAPIPATH}
131     else
132     export PATH=\${CRABPATH}:\${PATH}:\${CRABDLSAPIPATH}
133     fi
134     if [ -z "\$PYTHONPATH" ]; then
135     export PYTHONPATH=\${CRABPYTHON}:\${CRABDBSAPIPYTHON}:\${CRABDLSAPIPYTHON}:\${CRABPSETPYTHON}
136     else
137     export PYTHONPATH=\${CRABPYTHON}:\${PYTHONPATH}:\${CRABDBSAPIPYTHON}:\${CRABDLSAPIPYTHON}:\${CRABPSETPYTHON}
138     fi
139    
140     # BOSS related Stuff
141     source $BOSS_ROOT/bossenv.sh
142    
143     # check whether central boss db is configured
144    
145     # check if .bossrc dir exists
146    
147     if [ ! -d ~/.bossrc ]; then
148     mkdir ~/.bossrc
149     fi
150    
151     # check if *clad files exist
152    
153     if [ ! -e ~/.bossrc/BossConfig.clad ]; then
154     if [ -e ~/BossConfig.clad ]; then
155     cp ~/BossConfig.clad ~/.bossrc/BossConfig.clad
156     else
157     echo "User-boss DB not installed: run configureBoss"
158     return 1
159     fi
160     fi
161     if [ ! -e ~/.bossrc/SQLiteConfig.clad ]; then
162     if [ -e ~/SQLiteConfig.clad ]; then
163     cp ~/SQLiteConfig.clad ~/.bossrc/SQLiteConfig.clad
164     else
165     echo "User-boss DB not installed: run configureBoss"
166     return 1
167     fi
168     fi
169     if [ ! -e ~/.bossrc/MySQLRTConfig.clad ]; then
170     if [ -e ~/MySQLRTConfig.clad ]; then
171     cp ~/MySQLRTConfig.clad ~/.bossrc/MySQLRTConfig.clad
172     else
173     echo "User-boss DB not installed: run configureBoss"
174     return 1
175     fi
176     fi
177     # now check a boss command to see if boss DB is up and running
178     if [ \`boss clientID 1>/dev/null | grep -c "not correctly configured"\` -ne 0 ]; then
179     echo "User-boss DB not installed: run configureBoss"
180     return 1
181     fi
182     EOF
183    
184     # csh style
185     cat > crab.csh <<EOF
186     #! /bin/csh
187     # CRAB related Stuff
188     setenv CRABDIR $TopDir/..
189     setenv CRABSCRIPT \${CRABDIR}/script
190    
191     set CRABPATH=\${CRABDIR}/python
192     set CRABDLSAPIPATH=\${CRABDIR}/DLSAPI
193     setenv CRABPYTHON \${CRABDIR}/python
194     setenv CRABDBSAPIPYTHON \${CRABDIR}/DBSAPI
195     setenv CRABDLSAPIPYTHON \${CRABDIR}/DLSAPI
196     setenv CRABPSETPYTHON \${CRABDIR}/PsetCode
197    
198     if ( ! \$?path ) then
199     set path=(\${CRABPATH} \${CRABDLSAPIPATH})
200     else
201     set path=( \${CRABPATH} \${path} \${CRABDLSAPIPATH})
202     endif
203     if ( ! \$?PYTHONPATH ) then
204     setenv PYTHONPATH \${CRABPYTHON}:\${CRABDBSAPIPYTHON}:\${CRABDLSAPIPYTHON}:\${CRABPSETPYTHON}
205     else
206     setenv PYTHONPATH \${CRABPYTHON}:\${PYTHONPATH}:\${CRABDBSAPIPYTHON}:\${CRABDLSAPIPYTHON}:\${CRABPSETPYTHON}
207     endif
208    
209     # BOSS related Stuff
210     source $BOSS_ROOT/bossenv.csh
211    
212     # check whether central boss db is configured
213    
214     # check if .bossrc dir exists
215    
216     if ( ! -d ~/.bossrc ) then
217     mkdir ~/.bossrc
218     endif
219    
220     # check if *clad files exist
221     if ( ! -e ~/.bossrc/BossConfig.clad ) then
222     if ( -e ~/BossConfig.clad ) then
223     cp ~/BossConfig.clad ~/.bossrc/BossConfig.clad
224     else
225     echo "User-boss DB not installed: run configureBoss"
226     exit 1
227     endif
228     endif
229     if ( ! -e ~/.bossrc/SQLiteConfig.clad ) then
230     if ( -e ~/SQLiteConfig.clad ) then
231     cp ~/SQLiteConfig.clad ~/.bossrc/SQLiteConfig.clad
232     else
233     echo "User-boss DB not installed: run configureBoss"
234     exit 1
235     endif
236     endif
237     if ( ! -e ~/.bossrc/MySQLRTConfig.clad ) then
238     if ( -e ~/MySQLRTConfig.clad ) then
239     cp ~/MySQLRTConfig.clad ~/.bossrc/MySQLRTConfig.clad
240     else
241     echo "User-boss DB not installed: run configureBoss"
242     exit 1
243     endif
244     endif
245     # now check a boss command to see if boss DB is up and running
246     if ( \`boss clientID |& grep -c "not correctly configured"\` ) then
247     echo "User-boss DB not installed: run configureBoss"
248     exit 1
249     endif
250     EOF
251     return
252     }
253    
254 fanzago 1.1.2.1.2.2 function configureDBSAPI {
255     cd $TopDir
256     cd ..
257     if [ -d DBSAPI ] ; then
258     echo "DBSAPI already installed"
259     return
260     else
261     echo "copy DBS API from afs area"
262     cp -r /afs/cern.ch/user/f/fanzago/public/DBSAPI .
263     ls
264     return
265     fi
266     }
267    
268 fanzago 1.1.2.1 function configureDLSAPI {
269     # part for PyXML install
270 fanzago 1.1.2.1.2.2 cd $TopDir
271 fanzago 1.1.2.1 cd ..
272 fanzago 1.1.2.1.2.2 if [ -d DLSAPI ] ; then
273     echo "DLSAPI already installed"
274     return
275     else
276     cp -r /afs/cern.ch/user/f/fanzago/public/DLSAPI .
277     echo "DLSAPI Installation: begin at `date`"
278     cd DLSAPI
279     ./InstallPyXML.sh
280     echo "DLSAPI Installation: end at `date`"
281     return
282     fi
283 fanzago 1.1.2.1 }
284    
285     configureBoss
286 fanzago 1.1.2.1.2.1 configureCrab
287 fanzago 1.1.2.1.2.2 configureDBSAPI
288     configureDLSAPI
289 fanzago 1.1.2.1