10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-09 07:33:53 +01:00
quantum_package/scripts/unarchive_ezfio.sh

37 lines
769 B
Bash
Raw Normal View History

#!/bin/bash
#
# Reads a *.ezfio.md5 file, then fetches the proper data in the
# cache and re-creates the EZFIO database.
# 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))
for i in ${!key[@]}
do
MD5=${key[$i]}
file=${filename[$i]}
mkdir -p $(dirname $file)
cp ${QPACKAGE_ROOT}/data/cache/${MD5} ${file}
done