|
@ -165,19 +165,18 @@ download() { |
|
|
[ "$3" ] && local filename="$3" || local filename="$(basename $(echo "$1" | cut -d? -f1))" |
|
|
[ "$3" ] && local filename="$3" || local filename="$(basename $(echo "$1" | cut -d? -f1))" |
|
|
local path="$dir_source/$name/$filename" |
|
|
local path="$dir_source/$name/$filename" |
|
|
|
|
|
|
|
|
[ "$2" -a -f "$path" ] && local checksum="$(_mksum "$path")" || true |
|
|
if [ ! -e "$path" -o "$(_mksum "$path")" != "$2" ]; then |
|
|
|
|
|
|
|
|
if [ ! -e "$path" -o "$checksum" != "$2" ]; then |
|
|
|
|
|
_msg "Downloading $filename" |
|
|
_msg "Downloading $filename" |
|
|
|
|
|
|
|
|
[ "$4" ] && local cmd="$4" || local cmd="$cmd_download" |
|
|
[ "$4" ] && local cmd="$4" || local cmd="$cmd_download" |
|
|
eval $(echo "$cmd" | sed -e "s/{dst}/'$(safe_sed "$path")'/g" -e "s/{src}/'$(safe_sed "$1")'/g") |
|
|
eval $(echo "$cmd" | sed -e "s/{dst}/'$(safe_sed "$path")'/g" -e "s/{src}/'$(safe_sed "$1")'/g") |
|
|
|
|
|
|
|
|
checksum="$(_mksum "$path")" |
|
|
if [ "$2" -a "$(_mksum "$path")" != "$2" ]; then |
|
|
if [ "$2" -a "$checksum" != "$2" ]; then |
|
|
|
|
|
_msg "Checksum: $checksum" |
|
|
_msg "Checksum: $checksum" |
|
|
_exiterr 'Checksum failed' |
|
|
_exiterr 'Checksum failed' |
|
|
fi |
|
|
fi |
|
|
|
|
|
elif [ ! -f "$path" ]; then |
|
|
|
|
|
_exiterr "'$path' exists but isn't a file?" |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|