sha: Simplify function

This commit is contained in:
Dylan Araps 2020-05-13 10:28:16 +03:00
parent b2b55e5cdb
commit 9052d5cc3b
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 5 additions and 7 deletions

12
kiss
View File

@ -118,14 +118,12 @@ sh256() {
# Example: '<checksum> <file>'
[ -e "$1" ] || return 0
read -r hash _ <<-EOF
$(sha256sum "$1" ||
sha256 -r "$1" ||
openssl dgst -sha256 -r "$1" ||
shasum -a 256 "$1")
EOF
hash=$(sha256sum "$1" ||
sha256 -r "$1" ||
openssl dgst -sha256 -r "$1" ||
shasum -a 256 "$1")
printf '%s %s\n' "$hash" "$1"
printf '%s %s\n' "${hash%% *}" "$1"
} 2>/dev/null
pkg_lint() {