You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
488 B
24 lines
488 B
download() {
|
|
URL=$1
|
|
MD5=$2
|
|
TARGET=$3
|
|
|
|
if [ -e $TARGET ]; then
|
|
md5_result=`md5sum $TARGET | awk -F[' '] '{print $1}'`
|
|
if [ $MD5 == $md5_result ]; then
|
|
echo "$TARGET already exists, download skipped."
|
|
return 0
|
|
fi
|
|
fi
|
|
|
|
wget -c $URL -O "$TARGET"
|
|
if [ $? -ne 0 ]; then
|
|
return 1
|
|
fi
|
|
|
|
md5_result=`md5sum $TARGET | awk -F[' '] '{print $1}'`
|
|
if [ ! $MD5 == $md5_result ]; then
|
|
return 1
|
|
fi
|
|
}
|