From 1e5c09f75a3561eca737df508acbd6255a58ef20 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 Apr 2014 15:51:34 +0200 Subject: [PATCH] Fetch input MD5 files from the web into cache directory --- scripts/unarchive_ezfio.sh | 19 +++++++++++++++++-- setup_environment.sh | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) 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