buildx/hack/hash-files
CrazyMax 9c69ba6f6f
hack: use single output dir
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-24 08:30:35 +02:00

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
)