16 lines
653 B
Bash
16 lines
653 B
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
ENGINE="$(cd "$(dirname "$0")" && pwd)"
|
|
BINARY="$ENGINE/dist/receipt-engine-helper.app/Contents/MacOS/receipt-engine-helper"
|
|
STAMP="$ENGINE/dist/receipt-engine-helper.source.sha256"
|
|
SOURCE_HASH="$(bash "$ENGINE/engine-fingerprint.sh")"
|
|
if [ -x "$BINARY" ] && [ -f "$STAMP" ]; then
|
|
BINARY_HASH="$(shasum -a 256 "$BINARY" | cut -d ' ' -f 1)"
|
|
if [ "$(cat "$STAMP")" = "$(printf '%s\n%s' "$SOURCE_HASH" "$BINARY_HASH")" ]; then
|
|
echo "本地引擎与当前源码一致。"
|
|
exit 0
|
|
fi
|
|
fi
|
|
echo "本地引擎缺失或已过期,正在重新打包并验证导出功能…"
|
|
bash "$ENGINE/build-engine.sh"
|