interplane.Get Omega
Read in your language

aien

aien-dev/aien

Brought by drakestapleton

branch main Branches Tags History

aien / scripts / bots / build.sh

18 lines · 974 bytes Raw Blame History
1#!/bin/sh
2# Named migration build adapter only; runtime logic is src/bots/bots.om.
3set -eu
4HERE=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
5OUT=${1:?usage: build.sh OUTPUT}
6: "${OMEGA_OMC:?set OMEGA_OMC to e5b32567 omc}"
7: "${OMEGA_MV:?set OMEGA_MV to a checkout containing 55845e70}"
8[ "$(sha256sum < "$OMEGA_OMC" | cut -c1-64)" = 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f ] || { echo 'BLOCKED: omc pin mismatch' >&2; exit 3; }
9T=$(mktemp -d)
10trap 'rm -rf "$T"' EXIT HUP INT TERM
11git -C "$OMEGA_MV" show 55845e70:om/sha256/sha256-om2.om > "$T/sha.om"
12[ "$(sha256sum < "$T/sha.om" | cut -c1-64)" = dbf002dd6aa36585632b9d01d98ac3f0bd2fa0f0475082940de53638847994bb ] || { echo 'BLOCKED: SHA unit mismatch' >&2; exit 3; }
13sed 's/^export fn /fn /' "$T/sha.om" > "$T/unit.om"
14cat "$T/unit.om" "${BOTS_SOURCE:-$HERE/src/bots/bots.om}" > "$T/source.om"
15"$OMEGA_OMC" < "$T/source.om" > "$T/bots"
16chmod +x "$T/bots"
17mv "$T/bots" "$OUT"
18sha256sum "$OUT"