mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
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.
This commit is contained in:
parent
9f7123f5cd
commit
398523c89b
6
hgeditor
6
hgeditor
@ -41,13 +41,15 @@ HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$RANDOM.$RANDOM.$$"
|
||||
|
||||
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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user