code wiki / _hdl_build / nx_physlab_ship.nx

nx_physlab_ship.nx source

↩ module page · 27 lines · 1822 B

1// nx_physlab_ship.nx -- stage the nx_aw_push deploy inputs for PHYSLAB (clone of the proven mineworld ship): 2// src = knowledge/physlab.html (packed, vetted), dst = atomic cat+mv into the sites.elf docroot as 3// physlab/index.html so https://nishifamily.com/physlab serves it (dir/index.html pattern, purely ADDITIVE = 4// never-brick). Deploy = run nx_aw_push right after this in the SAME nishi-shell session. 5// license_tier: ORIGINAL expect_exit: 0 6import "nx_syscalls.nx" 7 8func pls_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 9 10func main() -> i64 { 11 let sfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.src\x00" as *u8, 420) 12 if sfd < 0 { pls_w("nx_physlab_ship: cannot stage awpush.src\n\x00" as *u8); return 1 } 13 let sp: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/physlab.html\n\x00" as *u8 14 var sn: i64 = 0 15 while sp[sn] != (0 as u8) { sn = sn + 1 } 16 sys_write(sfd, sp, sn) 17 sys_close(sfd) 18 let dfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.dst\x00" as *u8, 420) 19 if dfd < 0 { pls_w("nx_physlab_ship: cannot stage awpush.dst\n\x00" as *u8); return 2 } 20 let dp: *u8 = "mkdir -p /volume1/homes/elderwesto/nishihost/sites/nishifamily/physlab; cat > /volume1/homes/elderwesto/nishihost/sites/nishifamily/physlab/index.html.tmp; mv -f /volume1/homes/elderwesto/nishihost/sites/nishifamily/physlab/index.html.tmp /volume1/homes/elderwesto/nishihost/sites/nishifamily/physlab/index.html\n\x00" as *u8 21 var dn: i64 = 0 22 while dp[dn] != (0 as u8) { dn = dn + 1 } 23 sys_write(dfd, dp, dn) 24 sys_close(dfd) 25 pls_w("nx_physlab_ship: staged nx_aw_push inputs (physlab.html -> sites/nishifamily/physlab/index.html); deploy = run nx_aw_push\n\x00" as *u8) 26 return 0 27}