Changeset 353 for trunk/project_profile.sh
- Timestamp:
- 04/01/14 15:38:14 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/project_profile.sh
r352 r353 7 7 # project_profile.sh 8 8 # =================== 9 #10 9 # 11 10 # SYNOPSIS … … 135 134 usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir -jv jabrefversion -j jabrefdir -b bibtooldir" 136 135 # 137 while [ ${#} -gt 0 ] 138 do 139 case ${1} in 140 -d) 141 # directory for application chosen by user 142 # (see svn checkout command used) 143 directory=${2} 144 shift 145 ;; 146 -i) 147 # directory for inputs chosen by user 148 indir=${2} 149 shift 150 ;; 151 -o) 152 # directory for outputs chosen by user 153 outdir=${2} 154 shift 155 ;; 156 -t) 157 # directory for temporary outputs chosen by user 158 tempdir=${2} 159 shift 160 ;; 161 -jv) 162 jabrefversion=${2} 163 shift 164 ;; 165 -j) 166 jabrefdir=${2} 167 shift 168 ;; 169 -b) 170 bibtooldir=${2} 171 shift 172 ;; 173 *) 174 # other choice 175 echo "eee : unknown option ${1}" 176 echo "${usage}" 177 # nb : no exit because this file should be launched by 178 # login process 179 ;; 180 esac 181 # next flag 182 shift 183 done 184 unset usage 185 # 186 # check for ${directory} 187 if [ ! -d ${directory} ] 136 pb=0 137 # 138 minargcount=14 139 maxargcount=14 140 narg=${#} 141 # 142 if [ ${narg} -lt ${minargcount} ] 188 143 then 189 echo " eee : ${directory} not found" 144 echo "eee : not enough arguments (${narg} vs ${minargcount})" 145 echo "${usage}" 190 146 # nb : no exit because this file should be launched by login process 147 pb=1 191 148 fi 192 # 193 # check for permission on directory194 if [ ! -x ${directory} ]149 unset minargcount 150 # 151 if [ ${narg} -gt ${maxargcount} ] 195 152 then 196 echo " eee : ${directory} not reachable" 153 echo "eee : too many arguments (${narg} vs ${maxargcount})" 154 echo "${usage}" 197 155 # nb : no exit because this file should be launched by login process 156 pb=1 198 157 fi 199 # 200 PROJECT=${directory} 201 export PROJECT 202 # 203 # add PROJECT tools to PATH 204 # if not already done 205 suppath=$(echo ${PROJECT} | tr -s "/") 206 echo ${PATH} | grep -q "${suppath}:" 207 test_path=${?} 208 if [ ${test_path} -ne 0 ] 158 unset maxargcount 159 unset narg 160 # 161 if [ ${pb} -eq 0 ] 209 162 then 210 PATH=${suppath}:${PATH} 163 while [ ${#} -gt 0 ] 164 do 165 case ${1} in 166 -d) 167 # directory for application chosen by user 168 # (see svn checkout command used) 169 directory=${2} 170 shift 171 ;; 172 -i) 173 # directory for inputs chosen by user 174 indir=${2} 175 shift 176 ;; 177 -o) 178 # directory for outputs chosen by user 179 outdir=${2} 180 shift 181 ;; 182 -t) 183 # directory for temporary outputs chosen by user 184 tempdir=${2} 185 shift 186 ;; 187 -jv) 188 jabrefversion=${2} 189 shift 190 ;; 191 -j) 192 jabrefdir=${2} 193 shift 194 ;; 195 -b) 196 bibtooldir=${2} 197 shift 198 ;; 199 *) 200 # other choice 201 echo "eee : unknown option ${1}" 202 echo "${usage}" 203 # nb : no exit because this file should be launched by 204 # login process 205 ;; 206 esac 207 # next flag 208 shift 209 done 210 unset usage 211 fi 212 # 213 if [ ${pb} -eq 0 ] 214 then 215 # check for ${directory} 216 if [ ! -d ${directory} ] 217 then 218 echo " eee : ${directory} not found" 219 # nb : no exit because this file should be launched by login process 220 fi 221 # 222 # check for permission on directory 223 if [ ! -x ${directory} ] 224 then 225 echo " eee : ${directory} not reachable" 226 # nb : no exit because this file should be launched by login process 227 fi 228 # 229 PROJECT=${directory} 230 export PROJECT 231 # 232 # add PROJECT tools to PATH 233 # if not already done 234 suppath=$(echo ${PROJECT} | tr -s "/") 235 echo ${PATH} | grep -q "${suppath}:" 236 test_path=${?} 237 if [ ${test_path} -ne 0 ] 238 then 239 PATH=${suppath}:${PATH} 240 export PATH 241 else 242 # option bavarde oui/non pas encore implantée ++ 243 echo "${command} : iii : ${suppath} already in \${PATH}" 244 fi 245 unset test_path 246 unset suppath 247 # 248 suppath=$(echo ${PROJECT}/../branches/bibliolocean/src | tr -s "/") 249 echo ${PATH} | grep -q "${suppath}:" 250 test_path=${?} 251 if [ ${test_path} -ne 0 ] 252 then 253 PATH=${suppath}:${PATH} 254 export PATH 255 else 256 # option bavarde oui/non pas encore implantée ++ 257 echo "${command} : iii : ${suppath} already in \${PATH}" 258 fi 259 unset test_path 260 # 261 # add PROJECT tools to PYTHONPATH 262 # if not already done 263 suppath=$(echo ${PROJECT}/aeres/scripts/ | tr -s "/") 264 echo ${PYTHONPATH} | grep -q "${suppath}:" 265 test_path=${?} 266 if [ ${test_path} -ne 0 ] 267 then 268 PYTHONPATH=${suppath}:${PYTHONPATH} 269 export PYTHONPATH 270 else 271 # option bavarde oui/non pas encore implantée ++ 272 echo "${command} : iii : ${suppath} already in \${PYTHONPATH}" 273 fi 274 unset test_path 275 unset suppath 276 # 277 # add PROJECT tools to PYTHONPATH 278 # if not already done 279 suppath=$(echo ${PROJECT}/| tr -s "/") 280 echo ${PYTHONPATH} | grep -q "${suppath}:" 281 test_path=${?} 282 if [ ${test_path} -ne 0 ] 283 then 284 PYTHONPATH=${suppath}:${PYTHONPATH} 285 export PYTHONPATH 286 else 287 # option bavarde oui/non pas encore implantée ++ 288 echo "${command} : iii : ${suppath} already in \${PYTHONPATH}" 289 fi 290 unset test_path 291 unset suppath 292 # 293 # add PROJECT manuals to MANPATH 294 # if not already done 295 suppath=$(echo ${PROJECT}/doc/manuals/man | tr -s "/") 296 echo ${MANPATH} | grep -q "${suppath}:" 297 test_manpath=${?} 298 if [ ${test_manpath} -ne 0 ] 299 then 300 MANPATH=${suppath}:${MANPATH} 301 export MANPATH 302 else 303 # option bavarde oui/non pas encore implantée ++ 304 echo "${command} : iii : ${suppath} already in \${MANPATH}" 305 fi 306 unset test_manpath 307 unset suppath 308 # 309 PROJECT_LOG=${tempdir} 310 export PROJECT_LOG 311 unset tempdir 312 if [ ! -d ${PROJECT_LOG} ] 313 then 314 mkdir -p ${PROJECT_LOG} 315 status=${?} 316 if [ ${status} -ne 0 ] 317 then 318 echo "${command} : eee : can not create \${PROJECT_LOG}" 319 # nb : no exit because this file should be launched by login process 320 else 321 echo "${command} : iii : creation of \${PROJECT_LOG}" 322 fi 323 unset status 324 fi 325 # check for permission on PROJECT_LOG 326 if [ ! -x ${PROJECT_LOG} ] 327 then 328 echo " eee : ${PROJECT_LOG} not reachable" 329 # nb : no exit because this file should be launched by login process 330 fi 331 # 332 # check for permission on PROJECT_LOG 333 if [ ! -w ${PROJECT_LOG} ] 334 then 335 echo " eee : ${PROJECT_LOG} not writable" 336 # nb : no exit because this file shouldreachable be launched 337 # by login process 338 fi 339 # 340 EDITOR=vi 341 export EDITOR 342 # 343 # io directories 344 PROJECT_ID=${indir} 345 export PROJECT_ID 346 unset indir 347 if [ ! -d ${PROJECT_ID} ] 348 then 349 mkdir -p ${PROJECT_ID} 350 echo "${command} : iii : creation of \${PROJECT_ID}" 351 fi 352 # check for permission on PROJECT_ID 353 if [ ! -x ${PROJECT_ID} ] 354 then 355 echo " eee : ${PROJECT_ID} not reachable" 356 # nb : no exit because this file should be launched by login process 357 fi 358 # 359 PROJECT_OD=${outdir} 360 export PROJECT_OD 361 unset outdir 362 if [ ! -d ${PROJECT_OD} ] 363 then 364 mkdir -p ${PROJECT_OD} 365 echo "${command} : iii : creation of \${PROJECT_OD}" 366 fi 367 # check for permission on PROJECT_OD 368 if [ ! -x ${PROJECT_OD} ] 369 then 370 echo " eee : ${PROJECT_OD} not reachable" 371 # nb : no exit because this file should be launched by login process 372 fi 373 if [ ! -w ${PROJECT_OD} ] 374 then 375 echo " eee : ${PROJECT_OD} not writable" 376 # nb : no exit because this file should be launched by login process 377 fi 378 # 379 JABREF_DIR=${jabrefdir} 380 export JABREF_DIR 381 unset jabref_dir 382 JABREF_VERSION=${jabrefversion} 383 export JABREF_VERSION 384 unset jabrefversion 385 # 386 BIBTOOL_DIR=${bibtooldir} 387 export BIBTOOL_DIR 388 unset bibtooldir 389 PATH=${BIBTOOL_DIR}:${PATH} 211 390 export PATH 212 else 213 # option bavarde oui/non pas encore implantée ++ 214 echo "${command} : iii : ${suppath} already in \${PATH}" 215 fi 216 unset test_path 217 unset suppath 218 # 219 suppath=$(echo ${PROJECT}/../branches/bibliolocean/src | tr -s "/") 220 echo ${PATH} | grep -q "${suppath}:" 221 test_path=${?} 222 if [ ${test_path} -ne 0 ] 223 then 224 PATH=${suppath}:${PATH} 225 export PATH 226 else 227 # option bavarde oui/non pas encore implantée ++ 228 echo "${command} : iii : ${suppath} already in \${PATH}" 229 fi 230 unset test_path 231 # 232 # add PROJECT tools to PYTHONPATH 233 # if not already done 234 suppath=$(echo ${PROJECT}/aeres/scripts/ | tr -s "/") 235 echo ${PYTHONPATH} | grep -q "${suppath}:" 236 test_path=${?} 237 if [ ${test_path} -ne 0 ] 238 then 239 PYTHONPATH=${suppath}:${PYTHONPATH} 240 export PYTHONPATH 241 else 242 # option bavarde oui/non pas encore implantée ++ 243 echo "${command} : iii : ${suppath} already in \${PYTHONPATH}" 244 fi 245 unset test_path 246 unset suppath 247 # 248 # add PROJECT tools to PYTHONPATH 249 # if not already done 250 suppath=$(echo ${PROJECT}/| tr -s "/") 251 echo ${PYTHONPATH} | grep -q "${suppath}:" 252 test_path=${?} 253 if [ ${test_path} -ne 0 ] 254 then 255 PYTHONPATH=${suppath}:${PYTHONPATH} 256 export PYTHONPATH 257 else 258 # option bavarde oui/non pas encore implantée ++ 259 echo "${command} : iii : ${suppath} already in \${PYTHONPATH}" 260 fi 261 unset test_path 262 unset suppath 263 # 264 # add PROJECT manuals to MANPATH 265 # if not already done 266 suppath=$(echo ${PROJECT}/doc/manuals/man | tr -s "/") 267 echo ${MANPATH} | grep -q "${suppath}:" 268 test_manpath=${?} 269 if [ ${test_manpath} -ne 0 ] 270 then 271 MANPATH=${suppath}:${MANPATH} 272 export MANPATH 273 else 274 # option bavarde oui/non pas encore implantée ++ 275 echo "${command} : iii : ${suppath} already in \${MANPATH}" 276 fi 277 unset test_manpath 278 unset suppath 279 # 280 PROJECT_LOG=${tempdir} 281 export PROJECT_LOG 282 unset tempdir 283 if [ ! -d ${PROJECT_LOG} ] 284 then 285 mkdir -p ${PROJECT_LOG} 286 status=${?} 287 if [ ${status} -ne 0 ] 288 then 289 echo "${command} : eee : can not create \${PROJECT_LOG}" 290 # nb : no exit because this file should be launched by login process 291 else 292 echo "${command} : iii : creation of \${PROJECT_LOG}" 293 fi 294 unset status 295 fi 296 # check for permission on PROJECT_LOG 297 if [ ! -x ${PROJECT_LOG} ] 298 then 299 echo " eee : ${PROJECT_LOG} not reachable" 300 # nb : no exit because this file should be launched by login process 301 fi 302 # 303 # check for permission on PROJECT_LOG 304 if [ ! -w ${PROJECT_LOG} ] 305 then 306 echo " eee : ${PROJECT_LOG} not writable" 307 # nb : no exit because this file shouldreachable be launched 308 # by login process 309 fi 310 # 311 EDITOR=vi 312 export EDITOR 313 # 314 # io directories 315 PROJECT_ID=${indir} 316 export PROJECT_ID 317 unset indir 318 if [ ! -d ${PROJECT_ID} ] 319 then 320 mkdir -p ${PROJECT_ID} 321 echo "${command} : iii : creation of \${PROJECT_ID}" 322 fi 323 # check for permission on PROJECT_ID 324 if [ ! -x ${PROJECT_ID} ] 325 then 326 echo " eee : ${PROJECT_ID} not reachable" 327 # nb : no exit because this file should be launched by login process 328 fi 329 # 330 PROJECT_OD=${outdir} 331 export PROJECT_OD 332 unset outdir 333 if [ ! -d ${PROJECT_OD} ] 334 then 335 mkdir -p ${PROJECT_OD} 336 echo "${command} : iii : creation of \${PROJECT_OD}" 337 fi 338 # check for permission on PROJECT_OD 339 if [ ! -x ${PROJECT_OD} ] 340 then 341 echo " eee : ${PROJECT_OD} not reachable" 342 # nb : no exit because this file should be launched by login process 343 fi 344 if [ ! -w ${PROJECT_OD} ] 345 then 346 echo " eee : ${PROJECT_OD} not writable" 347 # nb : no exit because this file should be launched by login process 348 fi 349 # 350 JABREF_DIR=${jabrefdir} 351 export JABREF_DIR 352 unset jabref_dir 353 JABREF_VERSION=${jabrefversion} 354 export JABREF_VERSION 355 unset jabrefversion 356 # 357 BIBTOOL_DIR=${bibtooldir} 358 export BIBTOOL_DIR 359 unset bibtooldir 360 PATH=${BIBTOOL_DIR}:${PATH} 361 export PATH 362 # 363 # test if which xml is available xml or xmlstarlet 364 tool=xml 365 type ${tool} 1> /dev/null 2>&1 366 status=${?} 367 if [ ${status} -ne 0 ] 368 then 369 #echo "${command} : www : tool ${tool} not found" 370 tool=xmlstarlet 391 # 392 # test if which xml is available xml or xmlstarlet 393 tool=xml 371 394 type ${tool} 1> /dev/null 2>&1 372 395 status=${?} 373 396 if [ ${status} -ne 0 ] 374 397 then 375 echo "${command} : eee : tool ${tool} not found" 376 else 377 xmlcmd=xmlstarlet 378 fi 379 else 380 xmlcmd=xml 398 #echo "${command} : www : tool ${tool} not found" 399 tool=xmlstarlet 400 type ${tool} 1> /dev/null 2>&1 401 status=${?} 402 if [ ${status} -ne 0 ] 403 then 404 echo "${command} : eee : tool ${tool} not found" 405 else 406 xmlcmd=xmlstarlet 407 fi 408 else 409 xmlcmd=xml 410 fi 411 export xmlcmd 412 # 413 unset status 414 unset tool 381 415 fi 382 export xmlcmd 383 # 384 unset status 385 unset tool 386 416 unset pb 387 417 # end 388 418 unset command
Note: See TracChangeset
for help on using the changeset viewer.