From 9bbbcbcaea6e68fbd07da8e7b21749349dfd5315 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 9 Nov 2014 14:25:20 +0100 Subject: [PATCH] We now check dem sums --- astronaut | 10 +++++++--- hello.sat | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/astronaut b/astronaut index 757702a..ea4c5ab 100755 --- a/astronaut +++ b/astronaut @@ -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"")" } diff --git a/hello.sat b/hello.sat index 19e006f..10a522e 100644 --- a/hello.sat +++ b/hello.sat @@ -3,7 +3,8 @@ name=hello version=2.9 -dlextract "http://ftp.gnu.org/pub/gnu/$name/$name-$version.tar.gz" +dlextract "http://ftp.gnu.org/pub/gnu/$name/$name-$version.tar.gz" \ + "67607d2616a0faaf5bc94c59dca7c3cb" cd "$name-$version" ./configure