code wiki / _hdl_build / nx_instrument_ship.nx
nx_instrument_ship.nx source
↩ module page · 26 lines · 1814 B
1// nx_instrument_ship.nx -- stage nx_aw_push inputs for the INSTRUMENT dashboard (clone of nx_explodelab_ship):
2// src = knowledge/instrument.html (generated by nx_instrument_status), dst = atomic cat+mv into the docroot as
3// instrument/index.html so https://nishifamily.com/instrument serves it. Purely ADDITIVE (never-brick); not a
4// gated prefix = public. Deploy = run nx_aw_push right after. license_tier: ORIGINAL expect_exit: 0
5import "nx_syscalls.nx"
6
7func is_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
8
9func main() -> i64 {
10 let sfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.src\x00" as *u8, 420)
11 if sfd < 0 { is_w("nx_instrument_ship: cannot stage awpush.src\n\x00" as *u8); return 1 }
12 let sp: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/instrument.html\n\x00" as *u8
13 var sn: i64 = 0
14 while sp[sn] != (0 as u8) { sn = sn + 1 }
15 sys_write(sfd, sp, sn)
16 sys_close(sfd)
17 let dfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.dst\x00" as *u8, 420)
18 if dfd < 0 { is_w("nx_instrument_ship: cannot stage awpush.dst\n\x00" as *u8); return 2 }
19 let dp: *u8 = "mkdir -p /volume1/homes/elderwesto/nishihost/sites/nishifamily/instrument; cat > /volume1/homes/elderwesto/nishihost/sites/nishifamily/instrument/index.html.tmp; mv -f /volume1/homes/elderwesto/nishihost/sites/nishifamily/instrument/index.html.tmp /volume1/homes/elderwesto/nishihost/sites/nishifamily/instrument/index.html\n\x00" as *u8
20 var dn: i64 = 0
21 while dp[dn] != (0 as u8) { dn = dn + 1 }
22 sys_write(dfd, dp, dn)
23 sys_close(dfd)
24 is_w("nx_instrument_ship: staged (instrument.html -> sites/nishifamily/instrument/index.html); deploy = run nx_aw_push\n\x00" as *u8)
25 return 0
26}