Find IP of tun0 during transmission start up and set the configuration to bind to it. Closes #11

This commit is contained in:
Ian Neubert 2015-05-23 09:30:58 -07:00
parent 01cec65568
commit ceab19795b
4 changed files with 9 additions and 5 deletions

View File

@ -37,7 +37,6 @@ ENV PIA_USERNAME=**None** \
"TRANSMISSION_ALT_SPEED_TIME_ENABLED=false" \
"TRANSMISSION_ALT_SPEED_TIME_END=1020" \
"TRANSMISSION_ALT_SPEED_UP=50" \
"TRANSMISSION_BIND_ADDRESS_IPV4=0.0.0.0" \
"TRANSMISSION_BIND_ADDRESS_IPV6=::" \
"TRANSMISSION_BLOCKLIST_ENABLED=false" \
"TRANSMISSION_BLOCKLIST_URL=http://www.example.com/blocklist" \

View File

@ -38,13 +38,13 @@ fi
echo $TRANSMISSION_RPC_USERNAME > /config/transmission-credentials.txt
echo $TRANSMISSION_RPC_PASSWORD >> /config/transmission-credentials.txt
# setup transmission configuration
if [ ! -z ${KEEP_TRANSMISSION_STATE} ]
then
mkdir -p /data/transmission-data/
dockerize -template /etc/transmission-daemon/settings.tmpl:/data/transmission-data/settings.json true
dockerize -template /etc/transmission-daemon/settings.tmpl:/data/transmission-data/settings.json /bin/true
else
dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json true
dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json /bin/true
fi
exec openvpn --config "$OPEN_VPN_CONFIG"

View File

@ -6,7 +6,7 @@
"alt-speed-time-enabled": {{ .Env.TRANSMISSION_ALT_SPEED_TIME_ENABLED }},
"alt-speed-time-end": {{ .Env.TRANSMISSION_ALT_SPEED_TIME_END }},
"alt-speed-up": {{ .Env.TRANSMISSION_ALT_SPEED_UP }},
"bind-address-ipv4": "{{ .Env.TRANSMISSION_BIND_ADDRESS_IPV4 }}",
"bind-address-ipv4": "!!BINDIPV4!!",
"bind-address-ipv6": "{{ .Env.TRANSMISSION_BIND_ADDRESS_IPV6 }}",
"blocklist-enabled": {{ .Env.TRANSMISSION_BLOCKLIST_ENABLED }},
"blocklist-url": "{{ .Env.TRANSMISSION_BLOCKLIST_URL }}",

View File

@ -9,6 +9,11 @@ else
exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ &
fi
# determine IP of tun0, and bind to it
export TRANSMISSION_BIND_ADDRESS_IPV4=$(ifconfig tun0 | sed -n '2 p' | awk '{print $2}' | cut -d: -f2)
echo "BINDING TRANSMISSION to $TRANSMISSION_BIND_ADDRESS_IPV4"
perl -p -i -e 's/!!BINDIPV4!!/$ENV{"TRANSMISSION_BIND_ADDRESS_IPV4"}/' /etc/transmission-daemon/settings.json
exec /etc/transmission-daemon/startPortUpdates.sh &
echo "STARTED PORT UPDATER"