26 lines
1 KiB
Shell
26 lines
1 KiB
Shell
|
|
#!/bin/bash
|
||
|
|
# ZCode hooks self-checking entry (hash-pinned, codex-style exit 97).
|
||
|
|
# Update hashes below when the pinned scripts change on purpose.
|
||
|
|
set -uo pipefail
|
||
|
|
B="/Volumes/JZAO/铸渊-ICE-GL-ZY001/BRIDGE/tools"
|
||
|
|
LW_WANT="9cdd39496827ab0f3630bd498d0717b3f39331e2088217f729a4cde5c6dcd7cd"
|
||
|
|
TD_WANT="3fc76d43a2ee57118b9313812ad643f37635c45ef4b165c5b46f0887a5314dc6"
|
||
|
|
ACTION="${1:-hook}"
|
||
|
|
if [ "$#" -gt 0 ]; then shift; fi
|
||
|
|
check() {
|
||
|
|
local file="$1" want="$2"
|
||
|
|
local got
|
||
|
|
got="$(/usr/bin/shasum -a 256 "$B/$file" | /usr/bin/awk '{print $1}')"
|
||
|
|
if [ "$got" != "$want" ]; then
|
||
|
|
if [ "$ACTION" = "hook" ]; then
|
||
|
|
printf '%s\n' "【LW-LINK ○红·断连】原因:HOOK_SELF_CHECK_FAIL($file 被篡改或哈希过期) | 已拦截 | 恢复:核对 BRIDGE/tools 脚本后更新 zy-hook-entry.sh 内嵌哈希" >&2
|
||
|
|
fi
|
||
|
|
exit 97
|
||
|
|
fi
|
||
|
|
}
|
||
|
|
check lw-link-hook.sh "$LW_WANT"
|
||
|
|
check tcs-dynamic-entry-hook.sh "$TD_WANT"
|
||
|
|
case "$ACTION" in
|
||
|
|
tcs-*) exec bash "$B/tcs-dynamic-entry-hook.sh" "${ACTION#tcs-}" "$@" ;;
|
||
|
|
*) exec bash "$B/lw-link-hook.sh" "$ACTION" "$@" ;;
|
||
|
|
esac
|