2014-05-13 16:34:25 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
check_command() {
|
2016-09-24 15:34:14 +00:00
|
|
|
which "$1" >/dev/null 2>&1
|
2014-05-13 16:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if check_command sha512sum; then
|
|
|
|
ret="$(sha512sum "$@")"
|
|
|
|
elif check_command shasum; then
|
|
|
|
ret="$(shasum -a 512 "$@")"
|
|
|
|
elif check_command cksum; then
|
|
|
|
ret="$(cksum -q -a sha512 "$@")"
|
|
|
|
else
|
2016-10-10 04:17:54 +00:00
|
|
|
echo "$0: no suitable sha512sum implementation was found" >&2
|
2014-05-13 16:34:25 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ "$?" -eq 0 ] || exit 1
|
|
|
|
|
|
|
|
echo "$ret" | awk '{ print $1 }'
|