# $1 = download url
# $2 = filename to write to
function curl_file {
+ if [ -f $CACHE_DIR/$2 ]; then
+ echo "Removing stale $2"
+ rm -f $CACHE_DIR/$2
+ fi
echo "Downloading $1"
echo "Cache download location: $CACHE_DIR/$2"
until curl -C- -L -o $CACHE_DIR/$2 $1 || (( count++ >= 20 )); do
else
my_md5=$(grep ${filename} $CACHE_DIR/.cache | awk {'print $1'})
if [ "$remote_md5" != "$my_md5" ]; then
- echo "MD5 mismatch: Remote MD5 is ${remote_md5}, Cache file MD5 is ${my_md5}"
+ echo "MD5 mismatch, cache file MD5 is ${my_md5}"
echo "Downloading $filename"
curl_file $1 $filename
else