code wiki / _hdl_build / nx_hub_publish_bin.nx
nx_hub_publish_bin.nx source
↩ module page · 38 lines · 2427 B
1// nx_hub_publish_bin.nx -- submit the two HUB BINARIES to the publisher (policy=outward, operator-approval
2// gated; NO direct nx_aw_send). Separate from nx_hub_publish (content) so re-running never duplicates the
3// content rows. The publisher STAGES (verify landed-sha, ledger) on approval; the live atomic-promote +
4// daemon restart (sites.elf selfswap via the F-class runbook) remains the operator/hostctl step.
5// - nx_hub_gw.elf -> /volume1/ai/hub/nx_hub_gw.elf.new (new gateway, realm=nishi_site_admin)
6// - sites_daemon_v2.elf-> /volume1/homes/elderwesto/nishihost/sites.elf.new (VERIFIED live path; carries /hub route)
7// Sovereign: nx_syscalls + nx_publisher. license_tier: ORIGINAL
8import "nx_syscalls.nx"
9import "nx_publisher.nx"
10
11func pp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
12func pn(v: i64) -> i64 {
13 var m: i64 = v
14 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m }
15 let bb: *u8 = sys_mmap(28); var k: i64 = 0
16 if m == 0 { bb[0]=48 as u8; sys_write(1,bb,1); return 0 }
17 let t: *u8 = sys_mmap(28)
18 while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 }
19 var i: i64=0; while i<k { bb[i]=t[k-1-i]; i=i+1 }
20 sys_write(1,bb,k); return 0
21}
22func sub(src: *u8, dest: *u8, label: *u8) -> i64 {
23 let r: i64 = pub_submit(src, dest, "nishifamily.com" as *u8, "elderwesto" as *u8, "outward" as *u8)
24 pp(" submit " as *u8); pp(label as *u8); pp(" -> " as *u8)
25 if r == 1 { pp("QUEUED\n" as *u8) } else { pp("FAIL r=" as *u8); pn(r); pp("\n" as *u8) }
26 return r
27}
28
29func main(argc: i64, argv: *i64) -> i64 {
30 pp("=== nx_hub_publish_bin: hub BINARIES -> publisher governed queue (outward, operator-approval-gated) ===\n" as *u8)
31 var ok: i64 = 0
32 if sub("_offc/nx_hub_gw.elf" as *u8, "/volume1/ai/hub/nx_hub_gw.elf.new" as *u8, "nx_hub_gw.elf (gateway :18792)" as *u8) == 1 { ok = ok + 1 }
33 if sub("_offc/nx_sites_daemon_v2.elf" as *u8, "/volume1/homes/elderwesto/nishihost/sites.elf.new" as *u8, "sites.elf.new (+/hub route)" as *u8) == 1 { ok = ok + 1 }
34 pp("RESULT queued=" as *u8); pn(ok); pp("/2 (PENDING; promote = operator-approved selfswap. Pre-req: mkdir /volume1/ai/hub{,/pages} on NAS;\n" as *u8)
35 pp(" launch nx_hub_gw with the :9091 login daemon's keys/store [realm nishi_site_admin], port 18792.)\n" as *u8)
36 if ok == 2 { sys_exit(0); return 0 }
37 sys_exit(1); return 1
38}