mdns-reflector/entrypoint.sh
2026-08-07 15:54:32 +02:00

27 lines
714 B
Shell
Executable file

#!/bin/sh
# entrypoint.sh — mdns-reflector container entrypoint
#
# Expects interface names via env var INTERFACES (space-separated),
# or falls back to all non-loopback interfaces.
set -e
if [ $# -gt 0 ]; then
# Use CLI arguments (from docker run ... or CMD)
:
elif [ -n "$INTERFACES" ]; then
# shellcheck disable=SC2086
set -- $INTERFACES
else
# Auto-detect: all 'up' interfaces except loopback
set -- $(ip -o link show up | awk -F': ' '!/lo/{print $2}' | cut -d@ -f1)
fi
if [ $# -eq 0 ]; then
echo "ERROR: No interfaces found. Set INTERFACES env var or attach interfaces."
exit 1
fi
echo "[entrypoint] Starting mdns-repeater on: $*"
exec /usr/local/bin/mdns-repeater "$@"