diff --git a/Dockerfile b/Dockerfile index d5a6c73..bc31bea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" \ diff --git a/start.sh b/start.sh index 8909c2a..80f447f 100755 --- a/start.sh +++ b/start.sh @@ -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" diff --git a/transmission/defaultSettings.tmpl b/transmission/defaultSettings.tmpl index 3f3b11c..a4de625 100644 --- a/transmission/defaultSettings.tmpl +++ b/transmission/defaultSettings.tmpl @@ -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 }}", diff --git a/transmission/start.sh b/transmission/start.sh index 59a25f9..75f9547 100755 --- a/transmission/start.sh +++ b/transmission/start.sh @@ -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"