aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / tools / zero-legacy / gate.sh
| 1 | #!/bin/sh |
| 2 | # Bootstrap trust boundary: authenticate AIEN_OMC independently before executing it. |
| 3 | # Fixture judgments remain in gate.om; the compiler cannot authenticate itself. |
| 4 | set -eu |
| 5 | cd "$(dirname "$0")" |
| 6 | not_run() { echo "gate.sh: AIEN_OMC is unavailable or not independently pinned (NOT_RUN)" >&2; exit 3; } |
| 7 | [ -n "${AIEN_OMC:-}" ] && [ -x "$AIEN_OMC" ] || not_run |
| 8 | want=$(sed -n 's/^omc_sha256: //p' omega.pin) || not_run |
| 9 | [ "${#want}" -eq 64 ] || not_run |
| 10 | case "$want" in *[!0-9a-f]*) not_run ;; esac |
| 11 | have=$(sha256sum -- "$AIEN_OMC") || not_run |
| 12 | have=${have%% *} |
| 13 | [ "$have" = "$want" ] || not_run |
| 14 | mkdir -p build |
| 15 | "$AIEN_OMC" < gate.om > build/gate |
| 16 | chmod +x build/gate |
| 17 | exec build/gate "$AIEN_OMC" |