diff --git a/tools/ext-extract.sh b/tools/ext-extract.sh index 601b461a34..ea36e3ab99 100755 --- a/tools/ext-extract.sh +++ b/tools/ext-extract.sh @@ -48,8 +48,17 @@ mkdir -p "$tmpd" # One line per file: " ", the path relative to the tree and # without the git metadata (.git is a directory in a clone, a file in a # submodule checkout). +# sha256sum is GNU; NetBSD has cksum(1) -a sha256 ("SHA256 (path) = hex"), +# turned into the same " " line. +if command -v sha256sum > /dev/null 2>&1; then + sha256_files() { xargs -0 -r sha256sum; } +else + sha256_files() { + xargs -0 -r cksum -a sha256 | sed 's/^SHA256 (\(.*\)) = \(.*\)$/\2 \1/' + } +fi (cd "$src" && find . \( -name .git -o -path './.git/*' \) -prune -o \ - -type f -print0 | xargs -0 -r sha256sum) > "$tmpd/hashes" + -type f -print0 | sha256_files) > "$tmpd/hashes" full=0 [ -f "$list" ] && [ -d "$wrksrc" ] || full=1