| 123456789101112131415161718192021222324252627 |
- #!/bin/sh
- /sbin/openvpn_init.sh &
- # Match the owner of the mounted volumes (PUID/PGID), default 1000:1000
- PUID="${PUID:-1000}"
- PGID="${PGID:-1000}"
- if [ "$(id -u deluge)" != "$PUID" ] || [ "$(id -g deluge)" != "$PGID" ]; then
- groupmod -o -g "$PGID" deluge
- usermod -o -u "$PUID" -g "$PGID" deluge
- fi
- # /config is usually a mounted volume; make sure the deluge user can write to it
- chown -R deluge:deluge /config
- # Starting before the tunnel is up makes the first announces and DHT bootstrap fail
- echo "waiting for ${VPN_DEV:-tun0}"
- until ip -4 addr show dev "${VPN_DEV:-tun0}" 2>/dev/null | grep -q inet; do
- sleep 1
- done
- if [ "${PIA_PORT_FORWARD:-true}" = "true" ]; then
- /sbin/pia_port_forward.sh &
- fi
- echo starting deluge on port $PORT
- su deluge bash -c "deluged -c /config -d -p $PORT -u 0.0.0.0"
|