fix: make bundle-a2ui.sh cross-platform (support sha256sum and openssl fallbacks)
This commit is contained in:
parent
7f33621721
commit
87305e10f1
@ -18,6 +18,24 @@ INPUT_PATHS=(
|
|||||||
"$ROOT_DIR/apps/shared/ClawdbotKit/Tools/CanvasA2UI"
|
"$ROOT_DIR/apps/shared/ClawdbotKit/Tools/CanvasA2UI"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Cross-platform SHA256 hash function
|
||||||
|
sha256_hash() {
|
||||||
|
if command -v shasum &>/dev/null; then
|
||||||
|
shasum -a 256
|
||||||
|
elif command -v sha256sum &>/dev/null; then
|
||||||
|
sha256sum
|
||||||
|
else
|
||||||
|
# Fallback: use openssl or skip hashing
|
||||||
|
if command -v openssl &>/dev/null; then
|
||||||
|
openssl dgst -sha256 | awk '{print $NF}'
|
||||||
|
else
|
||||||
|
echo "warning: no sha256 tool found, skipping hash check" >&2
|
||||||
|
echo "SKIP"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
collect_files() {
|
collect_files() {
|
||||||
local path
|
local path
|
||||||
for path in "${INPUT_PATHS[@]}"; do
|
for path in "${INPUT_PATHS[@]}"; do
|
||||||
@ -32,8 +50,8 @@ collect_files() {
|
|||||||
compute_hash() {
|
compute_hash() {
|
||||||
collect_files \
|
collect_files \
|
||||||
| LC_ALL=C sort -z \
|
| LC_ALL=C sort -z \
|
||||||
| xargs -0 shasum -a 256 \
|
| xargs -0 sha256_hash \
|
||||||
| shasum -a 256 \
|
| sha256_hash \
|
||||||
| awk '{print $1}'
|
| awk '{print $1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user