2012-08-18 01:10:35 +02:00
|
|
|
#!/usr/bin/env bash
|
2011-02-16 09:25:19 +01:00
|
|
|
|
2011-06-10 15:31:20 +02:00
|
|
|
#root=$(readlink -f -- "$(dirname -- "$0")/..")
|
|
|
|
root=`perl -MCwd -e'print Cwd::abs_path(shift)' $(dirname -- "$0")/..`
|
2011-02-16 09:25:19 +01:00
|
|
|
work=$root/work
|
|
|
|
|
|
|
|
if [ ! -d $work ]; then
|
|
|
|
mkdir $work || exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
url=$1
|
|
|
|
outfile=$3
|
|
|
|
cachefile=$work/$outfile
|
|
|
|
if [ -s $cachefile ]; then
|
|
|
|
cp $work/$outfile $outfile || exit 1
|
|
|
|
else
|
2016-01-23 21:01:41 +01:00
|
|
|
wget $1 -O $3 || exit 1
|
2011-02-16 09:25:19 +01:00
|
|
|
if [ $? == 0 ]; then
|
|
|
|
cp $3 $work/ || exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|