2014-04-04 01:34:33 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2014-04-07 15:51:34 +02:00
|
|
|
# Reads a *.md5 file, then fetches the proper data in the
|
2014-04-04 01:34:33 +02:00
|
|
|
# cache and re-creates the EZFIO database.
|
2014-04-07 15:51:34 +02:00
|
|
|
# If the cache data is not present, download it from
|
|
|
|
# $QPACKAGE_CACHE_URL
|
2014-04-04 01:34:33 +02:00
|
|
|
# Fri Apr 4 01:02:53 CEST 2014
|
|
|
|
|
|
|
|
if [[ -z ${QPACKAGE_ROOT} ]]
|
|
|
|
then
|
|
|
|
print "The QPACKAGE_ROOT environment variable is not set."
|
|
|
|
print "Please reload the quantum_package.rc file."
|
|
|
|
fi
|
|
|
|
|
|
|
|
EZFIO_FILE=$(basename $(basename ${1} .md5))
|
|
|
|
|
|
|
|
if [[ -z $1 ]]
|
|
|
|
then
|
|
|
|
echo "Usage: $(basename $0) <EZFIO_FILE.md5>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -f ${EZFIO_FILE}.md5 ]]
|
|
|
|
then
|
|
|
|
echo "Error: ${EZFIO_FILE}.md5 does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-04-05 01:07:42 +02:00
|
|
|
key=($(cut -d ' ' -f 1 ${EZFIO_FILE}.md5))
|
|
|
|
filename=($(cut -d ' ' -f 2 ${EZFIO_FILE}.md5))
|
2014-04-04 01:34:33 +02:00
|
|
|
|
2014-04-07 15:51:34 +02:00
|
|
|
if [[ -z ${QPACKAGE_CACHE_URL} ]]
|
|
|
|
then
|
|
|
|
echo "Error: The QPACKAGE_CACHE_URL environment variable is not set."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-04-07 20:01:30 +02:00
|
|
|
VERSION=$( cut -d '=' -f 2 < ${QPACKAGE_ROOT}/EZFIO/version)
|
2014-04-04 01:34:33 +02:00
|
|
|
for i in ${!key[@]}
|
|
|
|
do
|
|
|
|
MD5=${key[$i]}
|
|
|
|
file=${filename[$i]}
|
2014-04-07 15:51:34 +02:00
|
|
|
if [[ ! -d $file ]]
|
|
|
|
then
|
|
|
|
mkdir -p $(dirname $file)
|
2014-04-07 20:01:30 +02:00
|
|
|
echo ${VERSION} > $(dirname $file)/.version
|
2014-04-07 15:51:34 +02:00
|
|
|
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
|
2014-04-04 01:34:33 +02:00
|
|
|
cp ${QPACKAGE_ROOT}/data/cache/${MD5} ${file}
|
|
|
|
done
|
2014-04-07 20:01:30 +02:00
|
|
|
echo ${VERSION} > ${EZFIO_FILE}.ezfio/.version
|