26 lines
1 KiB
Shell
Executable file
26 lines
1 KiB
Shell
Executable file
#!/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="58b8bf80329fc0cb2ca0b895dffcd5fafb8e40da933509fce25c042b5a66a6c4"
|
|
TD_WANT="18e8b0e63f5250bbb138f8d6707f7888f872bcb19fba1006a564254da777d06b"
|
|
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
|