From 629e8d0fac852170f75e142a38be3a88e5a9b664 Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sun, 10 May 2015 20:51:19 +0200 Subject: [PATCH] transmission startup handles setting.json, and possible to have transmission data-dir on mounted volume for persistent state --- Dockerfile | 2 +- runOpenVpn.sh | 4 ---- ...faultSettings.json => defaultSettings.tmpl} | 0 transmission/run.sh | 18 ++++++++++++++---- 4 files changed, 15 insertions(+), 9 deletions(-) rename transmission/{defaultSettings.json => defaultSettings.tmpl} (100%) diff --git a/Dockerfile b/Dockerfile index 789c96b..bcbc88d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN apt-get update \ ADD piaconfig/* /etc/openvpn/ ADD piaconfig/ca.crt /etc/openvpn/ca.crt ADD piaconfig/crl.pem /etc/openvpn/crl.pem -ADD transmission/defaultSettings.json /etc/transmission-daemon/settings.json +ADD transmission/defaultSettings.tmpl /etc/transmission-daemon/settings.tmpl ADD transmission/updateTransmissionPort.sh /etc/transmission-daemon/updatePort.sh ADD transmission/periodicUpdates.sh /etc/transmission-daemon/periodicUpdates.sh ADD transmission/run.sh /etc/transmission-daemon/start.sh diff --git a/runOpenVpn.sh b/runOpenVpn.sh index 4ea3f86..287d069 100755 --- a/runOpenVpn.sh +++ b/runOpenVpn.sh @@ -34,8 +34,4 @@ else echo $PIA_PASSWORD >> /config/pia-credentials.txt fi -dockerize \ - -template /etc/transmission-daemon/settings.json:/etc/transmission-daemon/settings.json \ - true - exec openvpn --config "$OPEN_VPN_CONFIG" diff --git a/transmission/defaultSettings.json b/transmission/defaultSettings.tmpl similarity index 100% rename from transmission/defaultSettings.json rename to transmission/defaultSettings.tmpl diff --git a/transmission/run.sh b/transmission/run.sh index 09bf33f..c640dcc 100755 --- a/transmission/run.sh +++ b/transmission/run.sh @@ -1,11 +1,21 @@ #!/bin/sh -if [ -f /config/transmission/settings.json ]; +if [ ! -z "${KEEP_TRANSMISSION_STATE}" ] then - echo "STARTING TRANSMISSION: Using custom config directory /config/transmission" - exec /usr/bin/transmission-daemon -g /config/transmission/ & + 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: No configuration provided, using defaults" + 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