Skip to content

Commit 22e9afe

Browse files
committed
use sha256 command instead of sha256sum on FreeBSD
1 parent 65de8ee commit 22e9afe

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

contrib/install_db4.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ check_exists() {
3232
sha256_check() {
3333
# Args: <sha256_hash> <filename>
3434
#
35-
if check_exists sha256sum; then
36-
echo "${1} ${2}" | sha256sum -c
35+
if [ "$(uname)" = "FreeBSD" ]; then
36+
# sha256sum exists on FreeBSD, but takes different arguments than the GNU version
37+
sha256 -c "${1}" "${2}"
38+
elif check_exists sha256sum; then
39+
echo "${1} ${2}" | sha256sum -c
3740
elif check_exists sha256; then
38-
if [ "$(uname)" = "FreeBSD" ]; then
39-
sha256 -c "${1}" "${2}"
40-
else
41-
echo "${1} ${2}" | sha256 -c
42-
fi
41+
echo "${1} ${2}" | sha256 -c
4342
else
44-
echo "${1} ${2}" | shasum -a 256 -c
43+
echo "${1} ${2}" | shasum -a 256 -c
4544
fi
4645
}
4746

0 commit comments

Comments
 (0)