qemu: start warden-modbus before warden-automation #12

Merged
noah merged 1 commits from qemu-init-modbus-order into flare-edge-next 2026-10-02 23:05:17 -06:00
3 changed files with 43 additions and 4 deletions
+2
View File
@@ -151,6 +151,8 @@ jobs:
run: bash qemu/tests/run-sh-args-test.sh
- name: rig init honours reboot/poweroff/halt (#5)
run: bash qemu/tests/init-power-signals-test.sh
- name: rig init daemon order matches the panel (flare-edge#348)
run: bash qemu/tests/init-daemon-order-test.sh
- name: mkimage.sh SEED_DIR regression test
# Only ui-drive.sh --seed (a real VM boot) exercises this hook
# otherwise; this builds the same unprivileged mkfs.ext4 image and
+4 -4
View File
@@ -105,14 +105,14 @@ if grep -qw warden.fwapply /proc/cmdline; then
echo "init: OTA APPLY ENABLED (warden.fwapply)"
fi
# The same daemons the panel's SysV scripts start, in their S-number order
# (S92 ai, S93 automation, S94 modbus, S95 mikrotik, S96 asic/starlink/
# stratum, S97 flared), each with no arguments and no environment, exactly
# as start-stop-daemon runs them there. A daemon that cannot live on -M virt
# (S21 modbus, S22 automation, S92 ai, S95 mikrotik, S96 asic/starlink/
# stratum, S97 flared; flare-edge#348), each with no arguments and no
# environment, exactly as start-stop-daemon runs them there. A daemon that cannot live on -M virt
# (warden-ai wants the NPU) exits into its log and the UI shows the same
# "not running" it would show on a panel whose daemon died; that is the
# panel's behaviour, not a rig substitute for it. warden-watchdog stays out:
# it and a payload flared do not mix (README).
for d in /usr/bin/warden-ai /usr/bin/warden-automation /usr/bin/warden-modbus \
for d in /usr/bin/warden-modbus /usr/bin/warden-automation /usr/bin/warden-ai \
/usr/bin/warden-mikrotik /usr/bin/warden-asic /usr/bin/warden-starlink \
/usr/bin/warden-stratum /usr/bin/warden-flared; do
if [ -x "$d" ]; then
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# The rig's /sbin/init starts the Warden daemons in the panel's S-number
# order (flare-edge#348): warden-modbus (S21modbus) before warden-automation
# (S22automation), since an automation's device command goes through
# warden-modbus, and both before the other app backends and flared. Reads
# the daemon list from the init script's own start loop.
set -uo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
INIT="$HERE/../rootfs/sbin/init"
FAIL=0
order=$(awk '
/^for d in \/usr\/bin\/warden-/ { on = 1 }
on {
last = ($0 ~ /; do$/)
for (i = 1; i <= NF; i++) if ($i ~ /^\/usr\/bin\/warden-/) { w = $i; sub(/;$/, "", w); print w }
if (last) exit
}' "$INIT")
want="/usr/bin/warden-modbus
/usr/bin/warden-automation
/usr/bin/warden-ai
/usr/bin/warden-mikrotik
/usr/bin/warden-asic
/usr/bin/warden-starlink
/usr/bin/warden-stratum
/usr/bin/warden-flared"
if [ "$order" = "$want" ]; then
echo "PASS: rig init starts the daemons in the panel's S-number order"
else
echo "FAIL: rig init daemon order differs from the panel's S-number order"
diff <(printf '%s\n' "$want") <(printf '%s\n' "$order")
FAIL=1
fi
exit "$FAIL"