Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienos.com/blob/main/om/aien-universe/check.sh # aienos.com Source of www.aienos.com, served from my own hardware Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienos.com / om / aien-universe / check.sh` 55 lines ยท 2317 bytes Raw Blame History 1 #!/bin/sh 2 # Regenerate the /aien/ universe controller using the pinned arm64 omc. 3 # The compiler is the one vendored for the Hive page; its pin is recorded once, 4 # in ../hive-page/omc.sha256. ../allen-page/contract.om is the shared /aien/ 5 # contract: the ids and routes this controller names come from its fields. 6 # CI on x86_64 checks the committed artifact against its recorded hash. 7 # OMEGA_OMC overrides the compiler path, never its pin. 8 # OMEGA_ACCEPT_CHANGE=1 accepts a rewritten artifact; otherwise stale output exits 4. 9 # Exit 2: missing compiler; 3: wrong pin; 4: stale artifact rewritten; 10 # 5: nondeterministic output; 6: empty output. Compile/run failures propagate. 11 set -eu 12 cd "$(dirname "$0")" 13 omc=${OMEGA_OMC:-$PWD/../hive-page/omc} 14 pin=$(tr -d ' \n' < ../hive-page/omc.sha256) 15 if [ ! -f "$omc" ]; then 16 printf 'No compiler at %s; set OMEGA_OMC to the pinned omc (%s)\n' "$omc" "$pin" >&2 17 exit 2 18 fi 19 have=$(sha256sum "$omc" | cut -d' ' -f1) 20 if [ "$have" != "$pin" ]; then 21 printf 'Compiler sha256 mismatch: recorded %s, found %s\n' "$pin" "$have" >&2 22 exit 3 23 fi 24 work=$(mktemp -d "${TMPDIR:-/tmp}/aien-universe.XXXXXX") 25 trap 'rm -rf "$work"' EXIT HUP INT TERM 26 # Concatenation composes Omega units; it does not implement generation in shell. 27 cat ../allen-page/contract.om universe.om > "$work/universe.om" 28 "$omc" < "$work/universe.om" > "$work/universe" 29 chmod +x "$work/universe" 30 "$work/universe" > "$work/first.js" 31 "$work/universe" > "$work/second.js" 32 if ! cmp -s "$work/first.js" "$work/second.js"; then 33 printf 'aien-universe.js: generator output differs between runs\n' >&2 34 exit 5 35 fi 36 if [ ! -s "$work/first.js" ]; then 37 printf 'aien-universe.js: generator wrote nothing\n' >&2 38 exit 6 39 fi 40 artifact=../../public/js/aien-universe.js 41 stale=0 42 if [ ! -f "$artifact" ] || ! cmp -s "$artifact" "$work/first.js"; then 43 stale=1 44 fi 45 cp "$work/first.js" "$artifact" 46 hash=$(sha256sum "$artifact" | cut -d' ' -f1) 47 printf '%s %s\n' "$hash" "$artifact" > aien-universe.js.sha256 48 printf '%s %s bytes sha256 %s\n' "$artifact" "$(wc -c < "$artifact" | tr -d ' ')" "$hash" 49 printf 'omc sha256 %s\n' "$have" 50 if [ "$stale" = 1 ]; then 51 printf 'Generated artifact was rewritten; commit it with its Omega sources\n' >&2 52 if [ "${OMEGA_ACCEPT_CHANGE:-0}" != 1 ]; then 53 exit 4 54 fi 55 fi