From f7a7c2d4b47016787b33111cb78582f9d2276b38 Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sun, 10 May 2015 22:15:25 +0200 Subject: [PATCH] fixing switch for keeping transmission state. also persist transmission rpc username and password for port updates if authentication is enabled. --- Dockerfile | 2 +- runOpenVpn.sh | 13 +++++++++++++ transmission/run.sh | 12 +----------- transmission/updateTransmissionPort.sh | 4 ++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index bcbc88d..e749218 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,7 +77,7 @@ ENV PIA_USERNAME=**None** \ "TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=false" \ "TRANSMISSION_RPC_BIND_ADDRESS=0.0.0.0" \ "TRANSMISSION_RPC_ENABLED=true" \ - "TRANSMISSION_RPC_PASSWORD={425745bf3914984c2abcc013276f40e8fa5d84ecC5.df8oF" \ + "TRANSMISSION_RPC_PASSWORD=password" \ "TRANSMISSION_RPC_PORT=9091" \ "TRANSMISSION_RPC_URL=/transmission/" \ "TRANSMISSION_RPC_USERNAME=username" \ diff --git a/runOpenVpn.sh b/runOpenVpn.sh index 287d069..8909c2a 100755 --- a/runOpenVpn.sh +++ b/runOpenVpn.sh @@ -34,4 +34,17 @@ else echo $PIA_PASSWORD >> /config/pia-credentials.txt fi +# add transmission credentials from env vars +echo $TRANSMISSION_RPC_USERNAME > /config/transmission-credentials.txt +echo $TRANSMISSION_RPC_PASSWORD >> /config/transmission-credentials.txt + + +if [ ! -z ${KEEP_TRANSMISSION_STATE} ] +then + mkdir -p /data/transmission-data/ + dockerize -template /etc/transmission-daemon/settings.tmpl:/data/transmission-data/settings.json true +else + dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json true +fi + exec openvpn --config "$OPEN_VPN_CONFIG" diff --git a/transmission/run.sh b/transmission/run.sh index c640dcc..59a25f9 100755 --- a/transmission/run.sh +++ b/transmission/run.sh @@ -1,21 +1,11 @@ #!/bin/sh -if [ ! -z "${KEEP_TRANSMISSION_STATE}" ] +if [ -f /data/transmission-data/settings.json ] then echo "STARTING TRANSMISSION: Using transmission-data subdirectory to your /data mount point to store state." - - # Initialize settings from environment variables - dockerize -template /etc/transmission-daemon/settings.tmpl:/data/transmission-data/settings.json \ - true - exec /usr/bin/transmission-daemon -g /data/transmission-data/ & else echo "STARTING TRANSMISSION: Storing state in container only." - - # Initialize settings from environment variables - dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json \ - true - exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ & fi diff --git a/transmission/updateTransmissionPort.sh b/transmission/updateTransmissionPort.sh index bcaedf7..f798ff1 100755 --- a/transmission/updateTransmissionPort.sh +++ b/transmission/updateTransmissionPort.sh @@ -13,9 +13,9 @@ 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 /config/transmission/settings.json ]; +if [ -f /data/transmission-data/settings.json ]; then - transmission_settings_file=/config/transmission/settings.json + transmission_settings_file=/data/transmission-data/settings.json else transmission_settings_file=/etc/transmission-daemon/settings.json fi