changeset 3025:d9b8d28c0b94

Find the system's MD5 binary. Different binaries calculate MD5 checksums on different systems. Try a couple known programs and only calculate and verify the checksum if they exist. This should silence warnings on eg OpenBSD.
author Will Maier <willmaier@ml1.net>
date Fri, 28 Jul 2006 13:46:19 -0500
parents b41cd423e5a3
children ea734528ce04 d161e6f39557
files hgeditor
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgeditor	Tue Aug 29 14:04:54 2006 -0500
+++ b/hgeditor	Fri Jul 28 13:46:19 2006 -0500
@@ -41,13 +41,15 @@
 
 cat "$1" > "$HGTMP/msg"
 
-CHECKSUM=`md5sum "$HGTMP/msg"`
+MD5=$(which md5sum 2>/dev/null) || \
+    MD5=$(which md5 2>/dev/null) 
+[ -x "${MD5}" ] && CHECKSUM=`${MD5} "$HGTMP/msg"`
 if [ -s "$HGTMP/diff" ]; then
     $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?
 else
     $EDITOR "$HGTMP/msg" || exit $?
 fi
-echo "$CHECKSUM" | md5sum -c >/dev/null 2>&1 && exit 13
+[ -x "${MD5}" ] && (echo "$CHECKSUM" | ${MD5} -c >/dev/null 2>&1 && exit 13)
 
 mv "$HGTMP/msg" "$1"