interplane.Get Omega
Read in your language

aien

aien-dev/aien

Brought by drakestapleton

branch main Branches Tags History

aien / scripts / goal_microjobs / canon-build.sh

23 lines · 1286 bytes Raw Blame History
1#!/bin/sh
2# Migration-only build adapter, aien-dev/aien#22: no runtime protocol logic.
3# OMEGA_OMC: e5b32567 omc; OMEGA_MV: checkout holding Omega 55845e70.
4# $1: output binary. No download, substitution, or stale output on refusal.
5set -eu
6HERE=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
7OUT=${1:-./canon}
8blocked() { echo "BLOCKED: $*" >&2; exit 3; }
9[ -x "${OMEGA_OMC:-}" ] || blocked 'set OMEGA_OMC to pinned omc'
10[ -n "${OMEGA_MV:-}" ] || blocked 'set OMEGA_MV to SHA unit checkout'
11[ "$(sha256sum < "$OMEGA_OMC" | cut -c1-64)" = 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f ] || blocked 'omc hash mismatch'
12T=$(mktemp -d)
13trap 'rm -rf "$T"' EXIT HUP INT TERM
14git -C "$OMEGA_MV" show 55845e70:om/sha256/sha256-om2.om > "$T/sha.om" || blocked 'missing SHA unit revision'
15[ "$(sha256sum < "$T/sha.om" | cut -c1-64)" = dbf002dd6aa36585632b9d01d98ac3f0bd2fa0f0475082940de53638847994bb ] || blocked 'SHA unit hash mismatch'
16# Existing protocols jobpath/build.sh convention: program-mode export removal only.
17sed 's/^export fn /fn /' "$T/sha.om" > "$T/unit.om"
18cat "$T/unit.om" "$HERE/src/goal_microjobs/canon.om" > "$T/source.om"
19"$OMEGA_OMC" < "$T/source.om" > "$T/canon"
20chmod +x "$T/canon"
21mv "$T/canon" "$OUT"
22printf 'built %s\n' "$OUT"
23sha256sum "$OUT"