Skip to content

Commit 4f24251

Browse files
author
Andrew Lorente
committed
Use GNU sha256sum if possible [EFForg#1504]
OSX doesn't ship with a sha256sum utility at all. Fortunately, the coreutils Homebrew package provides a gsha256sum, so we can fall back to that instead.
1 parent 983206f commit 4f24251

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

locate-gnu-utils.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ if [ -x "$GMKTEMP" ]; then
1616
MKTEMP="$GMKTEMP"
1717
fi
1818

19+
SHA256SUM=$(which sha256sum 2>/dev/null)
20+
GSHA256SUM=$(which gsha256sum 2>/dev/null)
21+
if [ -x "$GSHA256SUM" ]; then
22+
SHA256SUM="$GSHA256SUM"
23+
fi
24+
1925
check_for_gnu_version() {
2026
gnu_available=$("$1" --version 2>&1 | grep GNU)
2127
if [ ! "$gnu_available" ]; then
@@ -29,3 +35,4 @@ check_for_gnu_version() {
2935

3036
check_for_gnu_version "$MKTEMP" "mktemp"
3137
check_for_gnu_version "$READLINK" "readlink"
38+
check_for_gnu_version "$SHA256SUM" "sha256sum"

test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ bash test-ruleset-coverage.sh
6767
echo "To reproduce this build (https://wiki.debian.org/ReproducibleBuilds)," \
6868
"please use this version of sqlite3:"
6969
sqlite3 -version
70-
echo -e "Git commit `git rev-parse HEAD`\nsha256sum `sha256sum $XPI_NAME`"
70+
shasum=$("$SHA256SUM" "$XPI_NAME")
71+
echo -e "Git commit `git rev-parse HEAD`\nsha256sum $shasum"

0 commit comments

Comments
 (0)