summaryrefslogtreecommitdiff
path: root/f3s/pi-netbsd/bake/config.exp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-07 17:26:42 +0300
committerPaul Buetow <paul@buetow.org>2026-07-07 17:26:42 +0300
commit1aa5eb37c626f48bd725578637e5db4ae870ebfe (patch)
treeed0f2507a276947dc5cb9e285c8558873e4ea186 /f3s/pi-netbsd/bake/config.exp
parent213c92a36424d55f7a4650851ceb45c8a2283926 (diff)
ychat: bump image to deacb3f (fix chat color picker / POST body parsing)
Diffstat (limited to 'f3s/pi-netbsd/bake/config.exp')
-rwxr-xr-xf3s/pi-netbsd/bake/config.exp41
1 files changed, 41 insertions, 0 deletions
diff --git a/f3s/pi-netbsd/bake/config.exp b/f3s/pi-netbsd/bake/config.exp
new file mode 100755
index 0000000..1a3fe61
--- /dev/null
+++ b/f3s/pi-netbsd/bake/config.exp
@@ -0,0 +1,41 @@
+#!/usr/bin/expect -f
+# Blind-drive the NetBSD-in-qemu console to fetch+run setup.sh, verify, sync,
+# and power off. Paths come from the environment (set by bake-golden.sh):
+# NBIMG - raw work image (edited in place, then gzipped to the golden)
+# NBVARS - writable AAVMF (edk2) varstore
+# NBLOG - session log file
+# NBHTTP - host-side URL of setup.sh (reachable from the guest as 10.0.2.2)
+#
+# Lessons baked in: virtio-rng (entropy, else boot stalls / no ssh host keys),
+# run under LC_ALL=C (Tcl chokes on the serial's control bytes), blind login
+# with fixed sleeps + a quote-trick shell probe (expect's LIVE matching over the
+# TCG serial is unreliable), and judge success by the &&-chained command's
+# markers in NBLOG rather than by intermediate console matches.
+set timeout 700
+log_file -a $env(NBLOG)
+
+spawn qemu-system-aarch64 -M virt -cpu cortex-a72 -m 2048 -smp 2 -accel tcg \
+ -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \
+ -drive if=pflash,format=raw,readonly=on,file=/usr/share/AAVMF/AAVMF_CODE.fd \
+ -drive if=pflash,format=raw,file=$env(NBVARS) \
+ -drive file=$env(NBIMG),format=raw,if=virtio,cache=writeback \
+ -nic user -display none -serial stdio -monitor none
+
+# Fully blind login (root has no password on the stock image). expect's LIVE
+# console matching over the TCG serial is unreliable, so we do NOT probe for a
+# prompt — we just type, with generous settle time, and let bake-golden.sh judge
+# success from the SETUP_OK / halt markers in NBLOG afterward. Sending root twice
+# is harmless: the first logs in, a second lands as "root: not found" at a shell.
+sleep 135
+send "\r"; sleep 2
+send "root\r"; sleep 6
+send "\r"; sleep 2
+send "root\r"; sleep 6
+
+# one &&-chained command: fetch -> setup -> verify dump -> sync -> poweroff.
+# setup.sh prints SETUP_OK; the VBEGIN..VEND block is the on-disk verification.
+set timeout 600
+send "ftp -o /tmp/setup.sh $env(NBHTTP) && sh /tmp/setup.sh && echo VBEGIN && id paul && grep '^paul:' /etc/master.passwd && grep -E '^(hostname|ifconfig_mue0|defaultroute|dhcpcd|sshd)=' /etc/rc.conf && cat /home/paul/.ssh/authorized_keys && echo VEND && sync && sync && halt -p\r"
+expect { eof {} timeout { puts "\n!!TIMEOUT no poweroff" } }
+puts "\n==SESSION ENDED=="
+exit 0