feat(build-stack): mDNS preflight warnings (host avahi, dbus, interface count)

When ENABLE_MDNS=true, warn if BASE_DOMAIN isn't .local, host avahi-daemon
isn't running, the D-Bus socket is missing, or the host has many interfaces
(avahi self-collision risk → suggests allow-interfaces).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 06:05:44 +02:00
parent c7151b7333
commit 64f11c8120

View File

@@ -116,6 +116,13 @@ up() {
*.local) ;;
*) warn "ENABLE_MDNS=true but BASE_DOMAIN=$BASE_DOMAIN is not *.local — mDNS won't resolve it" ;;
esac
pgrep -x avahi-daemon >/dev/null 2>&1 \
|| warn "host avahi-daemon not detected — the avahi container publishes through it; start it (e.g. 'systemctl start avahi-daemon')"
[ -S /run/dbus/system_bus_socket ] \
|| warn "host D-Bus socket /run/dbus/system_bus_socket missing — avahi publish will fail"
local ifc; ifc=$(ip -o link show 2>/dev/null | wc -l)
[ "${ifc:-0}" -gt 6 ] \
&& warn "host has ${ifc} network interfaces — set 'allow-interfaces=<lan-nic>' in /etc/avahi/avahi-daemon.conf, else avahi self-collides (Local name collision)"
fi
log "PHASE up (mode=$mode${ENABLE_MDNS:+, mdns=$ENABLE_MDNS})"
have_script render-config.sh