diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2015-12-11 22:40:55 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2015-12-11 22:40:55 +0100 |
commit | 74663fdbbd1dc92dd91f6f88dbc4f972df12c404 (patch) | |
tree | 284817a1c9ff266a6474ae9d441eb53e7c514e6c /scripts/sha256sum | |
parent | 5847a9730ff284181c4087ed9ce85cf9955c47c3 (diff) |
Revert "rework prereq check"
This reverts commit fba2ff31928b18364c1934654169806f5c800e23.
Diffstat (limited to 'scripts/sha256sum')
-rwxr-xr-x | scripts/sha256sum | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/sha256sum b/scripts/sha256sum new file mode 100755 index 000000000..e70973364 --- /dev/null +++ b/scripts/sha256sum @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +if [ -x /usr/bin/sha256sum ]; then + /usr/bin/sha256sum "$@" +elif [ -x /bin/cksum ] && [ $(echo | cksum -a sha256) = 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b ]; then + # we assume the arguments are exactly "-c" or "-c -" + x=$(sed 's/^\([0-9a-fA-F]*\) *\([^ ].*\)$/SHA256 (\2) = \1/' | cksum -c -a sha256) + [[ $x = *FAILED* ]] && exit 1 + exit 0 +else + shasum -a 256 "$@" +fi |