interplane.Get Omega
Read in your language

aienos.com

Source of www.aienos.com, served from my own hardware

Brought by drakestapleton

branch main Branches Tags History

aienos.com / om / alpha-page / check.sh

37 lines · 1696 bytes Raw Blame History
1#!/bin/sh
2# Host orchestration only. Omega emits HTML/JS and escapes captured terminal/source bytes.
3# Source inputs are pinned release artifacts, never downloaded during a site build.
4set -eu
5cd "$(dirname "$0")"
6omc=${OMEGA_OMC:-../hive-page/omc}
7pin=$(tr -d ' \n' < ../hive-page/omc.sha256)
8[ "$(sha256sum "$omc" | cut -d' ' -f1)" = "$pin" ] || { echo 'Compiler pin mismatch' >&2; exit 3; }
9work=$(mktemp -d)
10trap 'rm -rf "$work"' EXIT HUP INT TERM
11"$omc" < page.om > "$work/page"
12"$omc" < client.om > "$work/client"
13chmod +x "$work/page" "$work/client"
14"$work/page" 4< wizard.capture.txt 5< ../../public/alpha/wizard.om > "$work/first.html"
15"$work/page" 4< wizard.capture.txt 5< ../../public/alpha/wizard.om > "$work/second.html"
16"$work/client" > "$work/first.js"
17"$work/client" > "$work/second.js"
18cmp "$work/first.html" "$work/second.html"
19cmp "$work/first.js" "$work/second.js"
20[ -s "$work/first.html" ] && [ -s "$work/first.js" ]
21# Negative control: missing capture input must refuse, not silently publish a blank capture.
22if "$work/page" 4< /dev/null 5< ../../public/alpha/wizard.om > "$work/refused.html"; then
23 echo 'Empty capture wrongly accepted' >&2; exit 5
24fi
25stale=0
26publish() {
27 if [ ! -f "$2" ] || ! cmp -s "$1" "$2"; then stale=1; fi
28 cp "$1" "$2"
29 sha256sum "$2" > "$3"
30}
31publish "$work/first.html" main.html main.html.sha256
32publish "$work/first.js" ../../public/js/alpha.js alpha.js.sha256
33sha256sum ../../public/alpha/wizard.om > wizard.om.sha256
34if [ "$stale" = 1 ] && [ "${OMEGA_ACCEPT_CHANGE:-0}" != 1 ]; then
35 echo 'Artifacts changed; commit the generated files with their Omega sources' >&2; exit 4
36fi
37printf 'ALPHA-GENERATED PASS compiler=%s\n' "$pin"