code wiki / _hdl_build / nx_explodelab_ship.nx
nx_explodelab_ship.nx source
↩ module page · 28 lines · 1962 B
1// nx_explodelab_ship.nx -- stage the nx_aw_push deploy inputs for EXPLODELAB (clone of the proven physlab/
2// charlab ship): src = knowledge/explodelab.html (packed + VET-GREEN byte-identical vm-vs-native), dst =
3// atomic cat+mv into the sites.elf docroot as explodelab/index.html so https://nishifamily.com/explodelab
4// serves it (dir/index.html clean-URL pattern, purely ADDITIVE = never-brick; /explodelab is NOT a gated
5// prefix so it serves public). Deploy = run nx_aw_push right after this in the SAME session.
6// license_tier: ORIGINAL expect_exit: 0
7import "nx_syscalls.nx"
8
9func els_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
10
11func main() -> i64 {
12 let sfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.src\x00" as *u8, 420)
13 if sfd < 0 { els_w("nx_explodelab_ship: cannot stage awpush.src\n\x00" as *u8); return 1 }
14 let sp: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/explodelab.html\n\x00" as *u8
15 var sn: i64 = 0
16 while sp[sn] != (0 as u8) { sn = sn + 1 }
17 sys_write(sfd, sp, sn)
18 sys_close(sfd)
19 let dfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.dst\x00" as *u8, 420)
20 if dfd < 0 { els_w("nx_explodelab_ship: cannot stage awpush.dst\n\x00" as *u8); return 2 }
21 let dp: *u8 = "mkdir -p /volume1/homes/elderwesto/nishihost/sites/nishifamily/explodelab; cat > /volume1/homes/elderwesto/nishihost/sites/nishifamily/explodelab/index.html.tmp; mv -f /volume1/homes/elderwesto/nishihost/sites/nishifamily/explodelab/index.html.tmp /volume1/homes/elderwesto/nishihost/sites/nishifamily/explodelab/index.html\n\x00" as *u8
22 var dn: i64 = 0
23 while dp[dn] != (0 as u8) { dn = dn + 1 }
24 sys_write(dfd, dp, dn)
25 sys_close(dfd)
26 els_w("nx_explodelab_ship: staged nx_aw_push inputs (explodelab.html -> sites/nishifamily/explodelab/index.html); deploy = run nx_aw_push\n\x00" as *u8)
27 return 0
28}