Browse Source

Fixed MD5 checking

master
mid-kid 10 years ago
parent
commit
d9905874a7
  1. 15
      astronaut

15
astronaut

@ -13,7 +13,7 @@ Just describe what he's got to do in a satellite file.
Usage: $0 [-s <dir>] [-b <dir>] [-i <dir>] <satellite>
-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"

Loading…
Cancel
Save