diff --git a/qemu/README.md b/qemu/README.md index 15e0c07..3b6e72a 100644 --- a/qemu/README.md +++ b/qemu/README.md @@ -85,6 +85,11 @@ does on a panel instead of rejecting every attempt. `qemu_stage_rootfs()` the executable bit, so the checked-out source file's own mode depends on the checking-out umask and cannot be trusted to arrive non-world-readable. +A flow seed may contain `qemu-flow-setup.sh`. Stage-2 init runs it inside the +disposable guest after mounting userdata and before starting daemons or the +UI. A nonzero exit stops the boot. Use it only for test devices and commands +that the virt machine does not provide. + ## Scenarios All take the virt-fragment ``; `FLARE_EDGE=` where noted. diff --git a/qemu/rootfs/sbin/init b/qemu/rootfs/sbin/init index 37fee35..98f05db 100755 --- a/qemu/rootfs/sbin/init +++ b/qemu/rootfs/sbin/init @@ -57,6 +57,16 @@ mount_fatal userdata /userdata mount_fatal "oem${slot}" /oem mkdir -p /userdata/warden +# A flow may seed an opt-in guest fixture before the UI and payload daemons +# start. The file lives only in this disposable QEMU disk image. Fail the +# boot if setup fails so a flow cannot pass against an unprepared guest. +if [ -f /userdata/warden/qemu-flow-setup.sh ]; then + if ! /bin/busybox sh /userdata/warden/qemu-flow-setup.sh; then + echo "FATAL: QEMU flow setup failed" + poweroff -f + fi +fi + # RS485: warden-modbus hardcodes /dev/ttyS4 at compile time; alias it to the # VM's RS485 pci-serial UART (needs the virt.fragment kernel). run.sh lists # the control channel's port first when there is one (warden.ctl on the