#!/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"