Skip to content

Commit

Permalink
Closes haugene#23 - Ensure TRANSMISSION_HOME is on a persistent volum…
Browse files Browse the repository at this point in the history
…e to store torrent resume info
  • Loading branch information
dougnukem committed Aug 13, 2015
1 parent fa0a0d6 commit 8d43c09
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ ENV PIA_USERNAME=**None** \
"TRANSMISSION_UTP_ENABLED=true" \
"TRANSMISSION_WATCH_DIR=/data/watch" \
"TRANSMISSION_WATCH_DIR_ENABLED=true" \
"TRANSMISSION_HOME=/data/transmission-home" \
RESOLV_OVERRIDE=**None**

# Expose port and run
Expand Down
2 changes: 1 addition & 1 deletion transmission/environment-variables.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/sh

export TRANSMISSION_HOME={{ .Env.TRANSMISSION_HOME }}
export TRANSMISSION_ALT_SPEED_DOWN={{ .Env.TRANSMISSION_ALT_SPEED_DOWN }}
export TRANSMISSION_ALT_SPEED_ENABLED={{ .Env.TRANSMISSION_ALT_SPEED_ENABLED }}
export TRANSMISSION_ALT_SPEED_TIME_BEGIN={{ .Env.TRANSMISSION_ALT_SPEED_TIME_BEGIN }}
Expand Down
6 changes: 4 additions & 2 deletions transmission/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ echo "Updating TRANSMISSION_BIND_ADDRESS_IPV4 to tun0 ip: ${tun0ip}"
export TRANSMISSION_BIND_ADDRESS_IPV4=${tun0ip}

echo "Generating transmission settings.json from env variables"
dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json /bin/true
# Ensure TRANSMISSION_HOME is created
mkdir -p ${TRANSMISSION_HOME}
dockerize -template /etc/transmission-daemon/settings.tmpl:${TRANSMISSION_HOME}/settings.json /bin/true

echo "STARTING TRANSMISSION"
exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ &
exec /usr/bin/transmission-daemon -g ${TRANSMISSION_HOME} &

echo "STARTING PORT UPDATER"
exec /etc/transmission-daemon/periodicUpdates.sh &
Expand Down
5 changes: 4 additions & 1 deletion transmission/updatePort.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#! /bin/sh

# Source our persisted env variables from container startup
. /etc/transmission-daemon/environment-variables.sh

# Settings
PIA_PASSWD_FILE=/config/pia-credentials.txt
TRANSMISSION_PASSWD_FILE=/config/transmission-credentials.txt
Expand All @@ -10,7 +13,7 @@ transmission_username=$(head -1 $TRANSMISSION_PASSWD_FILE)
transmission_passwd=$(tail -1 $TRANSMISSION_PASSWD_FILE)
local_vpn_ip=$(ip addr show tun0 | grep inet | awk '{ print $2 }')
pia_client_id_file=/etc/transmission-daemon/pia_client_id
transmission_settings_file=/etc/transmission-daemon/settings.json
transmission_settings_file=${TRANSMISSION_HOME}/settings.json
port_assignment_url=https://www.privateinternetaccess.com/vpninfo/port_forward_assignment

#
Expand Down

0 comments on commit 8d43c09

Please sign in to comment.