Fetch input MD5 files from the web into cache directory

This commit is contained in:
Anthony Scemama 2014-04-07 15:51:34 +02:00
parent 950876f794
commit 1e5c09f75a
2 changed files with 18 additions and 3 deletions

View File

@ -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

View File

@ -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