File indexing completed on 2025-01-30 09:17:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
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
0029 while [[ "$1" == -* ]]; do
0030
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;
0057 ;;
0058 esac
0059 shift;
0060 done;
0061
0062
0063
0064
0065 if test ! -f ${source}; then
0066 base=`basename ${source}`;
0067 dir=`dirname ${source}`;
0068 source=${dir}/data/${base};
0069 fi;
0070
0071
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
0083
0084
0085
0086 exit 2;
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;
0092 fi;
0093 cd ${target};
0094 echo "${target} : tar -xf ${source}";
0095 `which tar` -xf ${source};
0096
0097
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;
0104 fi;
0105 exit 0;