code wiki / _hdl_build / nx_charlab_ship.nx

nx_charlab_ship.nx source

↩ module page · 26 lines · 1790 B

1// nx_charlab_ship.nx -- stage the nx_aw_push deploy inputs for CHARLAB (clone of the proven physlab ship): 2// src = knowledge/charlab.html, dst = atomic cat+mv into the docroot as charlab/index.html so 3// https://nishifamily.com/charlab serves it (dir/index.html pattern, purely ADDITIVE = never-brick). 4// Deploy = run nx_aw_push right after this in the SAME nishi-shell session. license_tier: ORIGINAL expect_exit: 0 5import "nx_syscalls.nx" 6 7func cls_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 { cls_w("nx_charlab_ship: cannot stage awpush.src\n\x00" as *u8); return 1 } 12 let sp: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/charlab.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 { cls_w("nx_charlab_ship: cannot stage awpush.dst\n\x00" as *u8); return 2 } 19 let dp: *u8 = "mkdir -p /volume1/homes/elderwesto/nishihost/sites/nishifamily/charlab; cat > /volume1/homes/elderwesto/nishihost/sites/nishifamily/charlab/index.html.tmp; mv -f /volume1/homes/elderwesto/nishihost/sites/nishifamily/charlab/index.html.tmp /volume1/homes/elderwesto/nishihost/sites/nishifamily/charlab/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 cls_w("nx_charlab_ship: staged nx_aw_push inputs (charlab.html -> sites/nishifamily/charlab/index.html); deploy = run nx_aw_push\n\x00" as *u8) 25 return 0 26}