diff --git a/Dockerfile b/Dockerfile index bc31bea..22609e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ FROM ubuntu:14.04 MAINTAINER Kristian Haugene VOLUME /data +VOLUME /config # Update packages and install software RUN apt-get update \ diff --git a/README.md b/README.md index f7f0521..fdf3766 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,6 @@ NB: Instructions on how to use your own Transmission settings, and how to connec |`OPEN_VPN_CONFIG` | Sets the PIA endpoint to connect to. | `OPEN_VPN_CONFIG=UK Southampton`| |`RESOLV_OVERRIDE` | The value of this variable will be written to `/etc/resolv.conf`. | `RESOLV_OVERRIDE=nameserver 8.8.8.8\nnameserver 8.8.4.4\n`| -## Storage options -| Variable | Function | Example | -|----------|----------|-------| -|`KEEP_TRANSMISSION_STATE`|If set, persists transmission data to your /data mount point. Keeps state between restarts. Delete the folder to disable this later. |`KEEP_TRANSMISSION_STATE=YES`| - ## Transmission configuration options You may override transmission options by setting the appropriate environment variable. diff --git a/start.sh b/start.sh index 80f447f..f0eaeb0 100755 --- a/start.sh +++ b/start.sh @@ -38,13 +38,4 @@ 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 /bin/true -else - 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/start.sh b/transmission/start.sh index 75f9547..fa488e6 100755 --- a/transmission/start.sh +++ b/transmission/start.sh @@ -1,19 +1,16 @@ #!/bin/sh -if [ -f /data/transmission-data/settings.json ] -then - echo "STARTING TRANSMISSION: Using transmission-data subdirectory to your /data mount point to store state." - exec /usr/bin/transmission-daemon -g /data/transmission-data/ & -else - echo "STARTING TRANSMISSION: Storing state in container only." - exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ & -fi +tun0ip=$(ifconfig tun0 | sed -n '2 p' | awk '{print $2}' | cut -d: -f2) +echo "Updating TRANSMISSION_BIND_ADDRESS_IPV4 to tun0 ip: ${tun0ip}" +export TRANSMISSION_BIND_ADDRESS_IPV4=${tun0ip} -# 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 +echo "Generating transmission settings.json from env variables" +dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json /bin/true +echo "STARTING TRANSMISSION" +exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ & + +echo "STARTING PORT UPDATER" exec /etc/transmission-daemon/startPortUpdates.sh & -echo "STARTED PORT UPDATER" +echo "Transmission startup script complete." diff --git a/transmission/updateTransmissionPort.sh b/transmission/updateTransmissionPort.sh index fac3e21..d1038fc 100755 --- a/transmission/updateTransmissionPort.sh +++ b/transmission/updateTransmissionPort.sh @@ -13,13 +13,6 @@ pia_client_id_file=/etc/transmission-daemon/pia_client_id transmission_settings_file=/etc/transmission-daemon/settings.json port_assignment_url=https://www.privateinternetaccess.com/vpninfo/port_forward_assignment -if [ -f /data/transmission-data/settings.json ]; -then - transmission_settings_file=/data/transmission-data/settings.json -else - transmission_settings_file=/etc/transmission-daemon/settings.json -fi - # # First get a port from PIA #