summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-08-15 16:29:11 -0400
committerJoey Hess <joey@kitenet.net>2011-08-15 16:29:16 -0400
commit8a38afd4795ce976978e3be0fd539cda1a3da243 (patch)
tree4b1506e06c917ea291214d46e099c1721e453400 /functions
parent7401415a4c6d90c48cbe8e8d9ca6cc8539c8f3c7 (diff)
downloaddebootstrap-8a38afd4795ce976978e3be0fd539cda1a3da243.tar.gz
Support using md5 and shaN programs, as found on FreeBSD, in addition to md5sum and shaNsum.
Based on the patch used for the FreeBSD port of debootstrap: http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/debootstrap/files/patch-functions?rev=1.3;content-type=text%2Fplain That entire patch should now be unnecessary.
Diffstat (limited to 'functions')
-rw-r--r--functions16
1 files changed, 14 insertions, 2 deletions
diff --git a/functions b/functions
index 80844de..e07ca69 100644
--- a/functions
+++ b/functions
@@ -249,9 +249,21 @@ verify_checksum () {
local expchecksum="$2"
local expsize="$3"
if [ "$DEBOOTSTRAP_CHECKSUM_FIELD" = "MD5SUM" ]; then
- relchecksum=`md5sum < "$1" | sed 's/ .*$//'`
+ if in_path md5sum; then
+ relchecksum=`md5sum < "$1" | sed 's/ .*$//'`
+ elif in_path md5; then
+ relchecksum=`md5 < "$1"`
+ else
+ error 1 SIGCHECK "Cannot check md5sum"
+ fi
else
- relchecksum=`sha${SHA_SIZE}sum < "$1" | sed 's/ .*$//'`
+ if in_path "sha${SHA_SIZE}sum"; then
+ relchecksum=`sha${SHA_SIZE}sum < "$1" | sed 's/ .*$//'`
+ elif in_path "sha${SHA_SIZE}"; then
+ relchecksum=`sha${SHA_SIZE} < "$1"`
+ else
+ error 1 SIGCHECK "Cannot check sha${SHA_SIZE}sum"
+ fi
fi
relsize=`wc -c < "$1"`
if [ "$expsize" -ne "$relsize" ] || [ "$expchecksum" != "$relchecksum" ]; then