|
|
@ -54,9 +54,13 @@ msg() { |
|
|
|
download() { |
|
|
|
local name=$(basename "$1") |
|
|
|
local path="$dir_source/$name" |
|
|
|
if [ ! -f "$path" ]; then |
|
|
|
local checksum="" |
|
|
|
if [ "$2" -a -f "$path" ]; then |
|
|
|
checksum="$(md5sum ""$path"" 2> /dev/null | cut -d' ' -f1)" |
|
|
|
fi |
|
|
|
if [ ! -f "$path" -o "$checksum" != "$2" ]; then |
|
|
|
msg "Downloading $name" |
|
|
|
if [ "$2" ]; then |
|
|
|
if [ "$3" ]; then |
|
|
|
local cmd="$(echo "$2" | sed -e 's@{dst}@'"$path"'@g' -e 's@{source}@'"$1"'@g')" |
|
|
|
$cmd |
|
|
|
else |
|
|
@ -76,7 +80,7 @@ extract() { |
|
|
|
} |
|
|
|
|
|
|
|
dlextract() { |
|
|
|
download "$1" |
|
|
|
download "$1" "$2" |
|
|
|
extract "$(basename ""$1"")" |
|
|
|
} |
|
|
|
|
|
|
|