From 219ab9db30354e9f8c54a3cf5c205a9cf2c6f397 Mon Sep 17 00:00:00 2001
From: gavinhanson <gavin@cylo.io>
Date: Mon, 22 Jan 2018 16:39:36 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Updated=20deluge=20app.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Dockerfile                      | 9 +++++----
 configs/web.conf                | 2 +-
 root/Entrypoint.sh              | 6 ++++--
 root/etc/services.d/deluged/run | 3 +++
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index f853de7..9dd39af 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,6 +26,7 @@ RUN \
 	openssl \
 	p7zip \
 	unrar \
+	libcap \
 	unzip && \
  apk add --no-cache \
 	--repository http://nl.alpinelinux.org/alpine/edge/testing \
@@ -58,9 +59,9 @@ RUN mkdir /configs
 COPY configs /configs
 RUN chmod +x /Entrypoint.sh
 
-# ports
-EXPOSE 8112 58846 58946 58946/udp
+RUN setcap cap_net_bind_service=+ep /usr/bin/python2.7
 
-ENTRYPOINT /Entrypoint.sh
+# ports
+EXPOSE 80 58846 58946 58946/udp
 
-CMD ["/init"]
\ No newline at end of file
+ENTRYPOINT /Entrypoint.sh
\ No newline at end of file
diff --git a/configs/web.conf b/configs/web.conf
index eb4d63e..44c6d6a 100644
--- a/configs/web.conf
+++ b/configs/web.conf
@@ -15,5 +15,5 @@
   "default_daemon": "127.0.0.1:58846",
   "sidebar_multiple_filters": true,
   "pwd_salt": "5588bea86a36353faf34c488a54e81a39a8fab27",
-  "port": 8112
+  "port": 80
 }
\ No newline at end of file
diff --git a/root/Entrypoint.sh b/root/Entrypoint.sh
index 47d6051..d0d0fa8 100644
--- a/root/Entrypoint.sh
+++ b/root/Entrypoint.sh
@@ -13,9 +13,11 @@ mkdir -p /torrents/config/watch
 mv /configs/* /torrents/config/deluge/
 rm -fr /configs
 
-chown -R abc:abc /torrents
+chown -R 1000:1000 /torrents
 
 chmod +x /deluge-pass.py
 /deluge-pass.py /torrents/config/deluge ${DELUGE_PASSWORD}
 
-exec "/init"
+cat /torrents/config/deluge/auth | grep "${DELUGE_USERNAME}" || echo "${DELUGE_USERNAME}:${DELUGE_PASSWORD}:10" >> /torrents/config/deluge/auth
+
+exec "/init"
\ No newline at end of file
diff --git a/root/etc/services.d/deluged/run b/root/etc/services.d/deluged/run
index 0469502..dc611e4 100644
--- a/root/etc/services.d/deluged/run
+++ b/root/etc/services.d/deluged/run
@@ -4,6 +4,9 @@ UMASK_SET=${UMASK_SET:-022}
 
 umask "$UMASK_SET"
 
+s6-setuidgid abc /usr/bin/deluged -c /torrents/config/deluge/ -d --loglevel=info -l /torrents/config/log/deluged.log &
+echo $(date) && sleep 10 && echo $(date) && kill -9 $(pgrep -f '/usr/bin/deluged')
+
 exec \
 	s6-setuidgid abc /usr/bin/deluged -c /torrents/config/deluge/ \
 	-d --loglevel=info -l /torrents/config/log/deluged.log
-- 
GitLab