buildx/hack/hash-files

23 lines
454 B
Bash
Executable File

#!/usr/bin/env bash
set -eu -o pipefail
: "${DESTDIR=./bin/release}"
if [ ! -d "$DESTDIR" ]; then
exit 0
fi
# checksums
if ! command shasum > /dev/null 2>&1; then
echo >&2 "ERROR: shasum is required"
exit 1
fi
find ./${DESTDIR}/ -type f \( -iname "buildx-*" ! -iname "*darwin*" \) -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# .*/# #' > ./${DESTDIR}/checksums.txt
# verify
(
cd ./${DESTDIR}
shasum -a 256 -U -c checksums.txt
)