forked from thorrak/docker-mdns_repeater
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·24 lines (20 loc) · 992 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·24 lines (20 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
# These are now set in environment variables that are passed in
#EXTERNAL_INTERFACE="wlan0"
#DOCKER_NETWORK_NAME="fermentrack"
#OPTIONS=""
if [[ ${USE_MDNS_REPEATER} -eq 1 ]]; then
if [[ ${DOCKER_NETWORK_NAME} -eq 'bridge' ]]; then
exec mdns-repeater -f ${OPTIONS} "${EXTERNAL_INTERFACE}" "docker0"
else
# This searches the list of docker networks for the network name in order to get the ID, then (below) uses that ID
# to infer the docker interface name.
DOCKER_INTERFACE=$(docker network list | grep "${DOCKER_NETWORK_NAME}" | awk '{print $1}')
# Below is for future use in case I want to try to auto-detect the external interface
#NON_VIRTUAL_INTERFACES=($(ip addr | grep "state UP" -A2 | awk '/inet/{print $(NF)}' | grep -P '^(?:(?!veth).)*$' | tr '\n' ' '))
exec mdns-repeater -f ${OPTIONS} "${EXTERNAL_INTERFACE}" "br-${DOCKER_INTERFACE}"
fi
else
# If the local user has disabled the app, then just sleep forever
sleep infinity
fi