diff --git a/scripts/unarchive_ezfio.sh b/scripts/unarchive_ezfio.sh index d8ab1f9c..debc8527 100755 --- a/scripts/unarchive_ezfio.sh +++ b/scripts/unarchive_ezfio.sh @@ -1,7 +1,9 @@ #!/bin/bash # -# Reads a *.ezfio.md5 file, then fetches the proper data in the +# Reads a *.md5 file, then fetches the proper data in the # cache and re-creates the EZFIO database. +# If the cache data is not present, download it from +# $QPACKAGE_CACHE_URL # Fri Apr 4 01:02:53 CEST 2014 if [[ -z ${QPACKAGE_ROOT} ]] @@ -27,10 +29,23 @@ fi key=($(cut -d ' ' -f 1 ${EZFIO_FILE}.md5)) filename=($(cut -d ' ' -f 2 ${EZFIO_FILE}.md5)) +if [[ -z ${QPACKAGE_CACHE_URL} ]] +then + echo "Error: The QPACKAGE_CACHE_URL environment variable is not set." + exit 1 +fi + for i in ${!key[@]} do MD5=${key[$i]} file=${filename[$i]} - mkdir -p $(dirname $file) + if [[ ! -d $file ]] + then + mkdir -p $(dirname $file) + fi + if [[ ! -f ${QPACKAGE_ROOT}/data/cache/${MD5} ]] + then + ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${QPACKAGE_CACHE_URL}/${MD5} ${QPACKAGE_ROOT}/data/cache/${MD5} + fi cp ${QPACKAGE_ROOT}/data/cache/${MD5} ${file} done diff --git a/setup_environment.sh b/setup_environment.sh index 1be6688f..8475b1f6 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -24,7 +24,7 @@ export IRPF90=${IRPF90} export QPACKAGE_ROOT=${QPACKAGE_ROOT} export PATH+=:\${QPACKAGE_ROOT}/scripts export PATH+=:\${QPACKAGE_ROOT}/bin -export QPACKAGE_CACHE_URL="http://qmcchem.ups-tlse.fr/files/scemama/quantum_package/cache/" +export QPACKAGE_CACHE_URL="http://qmcchem.ups-tlse.fr/files/scemama/quantum_package/cache" EOF source quantum_package.rc