mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
Merge bitcoin/bitcoin#26772: contrib: fix sha256 check in install_db4.sh for FreeBSD
22e9afe40d
use sha256 command instead of sha256sum on FreeBSD (Murray Nesbitt)
Pull request description:
The FreeBSD version of `sha256sum` takes different arguments than the GNU version.
The `sha256_check` function in `contrib/install_db4.sh` has code specific to FreeBSD, however it doesn't get reached because while the `sha256sum` command does exist on FreeBSD, it is incompatible and results in an error:
```
sha256sum: option requires an argument -- c
usage: sha256sum [-pqrtx] [-c file] [-s string] [files ...]
```
This change moves the FreeBSD-specific code before the check for the `sha256sum` command.
Fixes: #26774
Top commit has no ACKs.
Tree-SHA512: 2485e2e7d8fdca3b072b29fb22bbdfd69e520740537b331b33c64cc645b63da712cfa63a23bdf039bbc92a6558fc7bf03323a51784bf601ff360ff0ef59506c8
This commit is contained in:
commit
4717a5aa31
1 changed files with 7 additions and 8 deletions
|
@ -32,16 +32,15 @@ check_exists() {
|
||||||
sha256_check() {
|
sha256_check() {
|
||||||
# Args: <sha256_hash> <filename>
|
# Args: <sha256_hash> <filename>
|
||||||
#
|
#
|
||||||
if check_exists sha256sum; then
|
if [ "$(uname)" = "FreeBSD" ]; then
|
||||||
echo "${1} ${2}" | sha256sum -c
|
# sha256sum exists on FreeBSD, but takes different arguments than the GNU version
|
||||||
|
sha256 -c "${1}" "${2}"
|
||||||
|
elif check_exists sha256sum; then
|
||||||
|
echo "${1} ${2}" | sha256sum -c
|
||||||
elif check_exists sha256; then
|
elif check_exists sha256; then
|
||||||
if [ "$(uname)" = "FreeBSD" ]; then
|
echo "${1} ${2}" | sha256 -c
|
||||||
sha256 -c "${1}" "${2}"
|
|
||||||
else
|
|
||||||
echo "${1} ${2}" | sha256 -c
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "${1} ${2}" | shasum -a 256 -c
|
echo "${1} ${2}" | shasum -a 256 -c
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue