diff --git a/astronaut b/astronaut
index ea4c5ab..4ad460f 100755
--- a/astronaut
+++ b/astronaut
@@ -13,7 +13,7 @@ Just describe what he's got to do in a satellite file.
Usage: $0 [-s
] [-b ] [-i ]
-s Set source directory
--b Set build directory
+-b Set build directory [WARNING: Will be deleted before build]
-i Set install directory"
}
@@ -51,12 +51,16 @@ msg() {
echo "=> $@"
}
+mksum() {
+ echo $(md5sum "$@" 2> /dev/null | cut -d' ' -f1)
+}
+
download() {
local name=$(basename "$1")
local path="$dir_source/$name"
local checksum=""
if [ "$2" -a -f "$path" ]; then
- checksum="$(md5sum ""$path"" 2> /dev/null | cut -d' ' -f1)"
+ checksum=$(mksum "$path")
fi
if [ ! -f "$path" -o "$checksum" != "$2" ]; then
msg "Downloading $name"
@@ -66,6 +70,12 @@ download() {
else
curl -#L -o "$path" "$1"
fi
+ checksum=$(mksum "$path")
+ if [ "$2" -a "$checksum" != "$2" ]; then
+ msg "Houston, we have a problem: Checksum failed."
+ msg "Checksum: $checksum"
+ exit 1
+ fi
fi
}
@@ -89,6 +99,7 @@ extrafile() {
}
# Create the satellite
+rm -rf "$dir_build"
mkdir -p "$dir_source"
mkdir -p "$dir_build"
mkdir -p "$dir_install"