Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:57

0001 #!/bin/bash
0002 #==========================================================================
0003 #  AIDA Detector description implementation 
0004 #--------------------------------------------------------------------------
0005 # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0006 # All rights reserved.
0007 #
0008 # For the licensing terms see $DD4hepINSTALL/LICENSE.
0009 # For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0010 #
0011 #==========================================================================
0012 #
0013 #  @author M.Frank
0014 #
0015 #==========================================================================
0016 echo "+ ------------------------------------------------------------------+";
0017 echo "|   Starting DDDB extraction from tar file                          |";
0018 echo "+ ------------------------------------------------------------------+";
0019 #
0020 if test -n "$USER"; then
0021     target=/tmp/$USER;
0022 else
0023     target=/tmp;
0024 fi;
0025 source=${DD4hepExamplesINSTALL}/examples/DDDB/DDDB.tar.gz;
0026 clean="NO";
0027 #
0028 # Check for arguments:
0029 while [[ "$1" == -* ]]; do
0030     #echo "Arg:$1 $2 [$*]";
0031     a1=`echo $1 | tr A-Z a-z`;
0032     case ${a1} in
0033         -to)
0034             target=$2;
0035             shift
0036             ;;
0037         -target)
0038             target=$2;
0039             shift
0040             ;;
0041         -dddb)
0042             source=$2;
0043             shift
0044             ;;
0045         -clean)
0046             clean="YES";
0047             ;;
0048         -input)
0049             source=$2;
0050             shift
0051             ;;
0052         *)
0053             echo "Usage: $0 -arg [-arg]";
0054             echo "  -target <directory>  Installation target directory. Default: $target";
0055             echo "  -input  <tar-file>   Input data file. Default: $source";
0056             exit 13;    # EACCES
0057             ;;
0058     esac
0059     shift;
0060 done;
0061 #
0062 # Seems like cmake install is not really deterministic and installs files either with or without
0063 # data source directory name....if input is not present try to add /data/.
0064 #
0065 if test ! -f ${source}; then
0066     base=`basename ${source}`;
0067     dir=`dirname ${source}`;
0068     source=${dir}/data/${base};
0069 fi;
0070 #
0071 # Now do the installation
0072 #
0073 if test -d ${target}/DDDB; then
0074     if test "${clean}" = "YES";then
0075         rm -rf ${target}/DDDB;
0076         echo "DDDB Database successfully removed ${target}";
0077         exit 0;
0078     fi;
0079     echo "DDDB database is already extracted to ${target}. Nothing to do.";
0080 elif test ! -f ${source}; then
0081     echo "DDDB database tar file ${source} is not present. [Installation FAILED]";
0082     #echo "Directory: /builds/CLICdp/DD4hep/examples/DDDB";
0083     #ls -laF /builds/CLICdp/DD4hep/examples/DDDB;
0084     #echo "Directory /builds/CLICdp/DD4hep/examples/DDDB/data";
0085     #ls -laF /builds/CLICdp/DD4hep/examples/DDDB/data;
0086     exit 2;  # ENOENT
0087 else
0088     mkdir -p ${target}/DDDB;
0089     if test ! -d ${target}/DDDB; then
0090         echo "DDDB database target directory ${target} cannot be created [Installation FAILED]";
0091         exit 2;  # ENOENT
0092     fi;
0093     cd ${target};
0094     echo "${target} : tar -xf ${source}";
0095     `which tar` -xf ${source};
0096     #/bin/ls -laF `dirname $source`;
0097     #/bin/ls -laF $target;
0098 fi;
0099 if test -f ${target}/DDDB/DDDB/lhcb.xml; then
0100     echo "DDDB Database successfully installed.";
0101 else
0102     echo "DDDB Database installation FAILED";
0103     exit 2;  # ENOENT
0104 fi;
0105 exit 0;