gluon/scripts/sha256sum.sh
Matthias Schiffer 9e6cfaee0d
scripts: generate SHA256 manifest lines in addition to SHA512
The current autoupdater will only respect the last line for a given model
name, so we can add SHA256 checksums as long as they occur before the
corresponding SHA512 line.
2017-02-25 00:38:50 +01:00

21 lines
383 B
Bash
Executable File

#!/bin/sh
check_command() {
which "$1" >/dev/null 2>&1
}
if check_command sha256sum; then
ret="$(sha256sum "$@")"
elif check_command shasum; then
ret="$(shasum -a 256 "$@")"
elif check_command cksum; then
ret="$(cksum -q -a sha256 "$@")"
else
echo "$0: no suitable sha256sum implementation was found" >&2
exit 1
fi
[ "$?" -eq 0 ] || exit 1
echo "$ret" | awk '{ print $1 }'