fix: use SHA256_CMD variable instead of function for xargs compatibility

This commit is contained in:
TAPUZE 2026-01-27 11:25:52 +02:00
parent 47b595df08
commit e011188c3d

View File

@ -18,23 +18,17 @@ INPUT_PATHS=(
"$ROOT_DIR/apps/shared/ClawdbotKit/Tools/CanvasA2UI" "$ROOT_DIR/apps/shared/ClawdbotKit/Tools/CanvasA2UI"
) )
# Cross-platform SHA256 hash function # Cross-platform SHA256 hash command
sha256_hash() { if command -v shasum &>/dev/null; then
if command -v shasum &>/dev/null; then SHA256_CMD="shasum -a 256"
shasum -a 256 elif command -v sha256sum &>/dev/null; then
elif command -v sha256sum &>/dev/null; then SHA256_CMD="sha256sum"
sha256sum elif command -v openssl &>/dev/null; then
else SHA256_CMD="openssl dgst -sha256"
# Fallback: use openssl or skip hashing else
if command -v openssl &>/dev/null; then echo "warning: no sha256 tool found, skipping hash check" >&2
openssl dgst -sha256 | awk '{print $NF}' SHA256_CMD="cat" # passthrough, will cause hash mismatch and rebuild
else fi
echo "warning: no sha256 tool found, skipping hash check" >&2
echo "SKIP"
return 0
fi
fi
}
collect_files() { collect_files() {
local path local path
@ -50,8 +44,8 @@ collect_files() {
compute_hash() { compute_hash() {
collect_files \ collect_files \
| LC_ALL=C sort -z \ | LC_ALL=C sort -z \
| xargs -0 sha256_hash \ | xargs -0 $SHA256_CMD \
| sha256_hash \ | $SHA256_CMD \
| awk '{print $1}' | awk '{print $1}'
} }