code wiki / _hdl_build / nx_gpulab_ship.nx

nx_gpulab_ship.nx source

↩ module page · 25 lines · 1664 B

1// nx_gpulab_ship.nx -- stage the nx_aw_push deploy for the GPU-Lab compat-tier page (clone of charlab ship): 2// src = knowledge/gpulab.html, dst = docroot gpulab/index.html -> https://nishifamily.com/gpulab (additive, 3// never-brick). Deploy = run nx_aw_push next. license_tier: ORIGINAL expect_exit: 0 4import "nx_syscalls.nx" 5 6func gls_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 7 8func main() -> i64 { 9 let sfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.src\x00" as *u8, 420) 10 if sfd < 0 { gls_w("nx_gpulab_ship: cannot stage awpush.src\n\x00" as *u8); return 1 } 11 let sp: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/gpulab.html\n\x00" as *u8 12 var sn: i64 = 0 13 while sp[sn] != (0 as u8) { sn = sn + 1 } 14 sys_write(sfd, sp, sn) 15 sys_close(sfd) 16 let dfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.dst\x00" as *u8, 420) 17 if dfd < 0 { gls_w("nx_gpulab_ship: cannot stage awpush.dst\n\x00" as *u8); return 2 } 18 let dp: *u8 = "mkdir -p /volume1/homes/elderwesto/nishihost/sites/nishifamily/gpulab; cat > /volume1/homes/elderwesto/nishihost/sites/nishifamily/gpulab/index.html.tmp; mv -f /volume1/homes/elderwesto/nishihost/sites/nishifamily/gpulab/index.html.tmp /volume1/homes/elderwesto/nishihost/sites/nishifamily/gpulab/index.html\n\x00" as *u8 19 var dn: i64 = 0 20 while dp[dn] != (0 as u8) { dn = dn + 1 } 21 sys_write(dfd, dp, dn) 22 sys_close(dfd) 23 gls_w("nx_gpulab_ship: staged nx_aw_push inputs (gpulab.html -> sites/nishifamily/gpulab/index.html); deploy = run nx_aw_push\n\x00" as *u8) 24 return 0 25}