set fixed transmission-daemon home, move dockerize settings.json till we know tun0 ip

This commit is contained in:
Kristian Haugene 2015-05-24 19:05:05 +02:00
parent 1d0e584591
commit 0d918b22f9
5 changed files with 11 additions and 34 deletions

View File

@ -6,6 +6,7 @@ FROM ubuntu:14.04
MAINTAINER Kristian Haugene
VOLUME /data
VOLUME /config
# Update packages and install software
RUN apt-get update \

View File

@ -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.

View File

@ -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"

View File

@ -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."

View File

@ -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
#