From 8c1902d8b05ce183185fa607f1f51fa401f33780 Mon Sep 17 00:00:00 2001
From: sparklyballs <sparklyballs@gmail.com>
Date: Sat, 29 Apr 2017 14:42:35 +0100
Subject: [PATCH] allow user defined umask via environment variable

---
 README.md                          | 7 +++++--
 root/etc/services.d/deluge-web/run | 4 +++-
 root/etc/services.d/deluged/run    | 4 +++-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 1609faa..e44cc03 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,7 @@ docker create \
   --net=host \
   -e PUID=<UID> -e PGID=<GID> \
   -e TZ=<timezone> \
+  -e UMASK_SET=<022> \
   -v </path/to/your/downloads>:/downloads \
   -v </path/to/deluge/config>:/config \
   linuxserver/deluge
@@ -48,8 +49,9 @@ http://192.168.x.x:8080 would show you what's running INSIDE the container on po
 * `--net=host` - Shares host networking with container, **required**.
 * `-v /config` - deluge configs
 * `-v /downloads` - torrent download directory
-* `-e PGID` for for GroupID - see below for explanation
-* `-e PUID` for for UserID - see below for explanation
+* `-e PGID` for GroupID - see below for explanation
+* `-e PUID` for UserID - see below for explanation
+* `-e UMASK_SET` for umask setting of deluge, default if left unset is 022. 
 * `-e TZ` for timezone information, eg Europe/London
 
 It is based on alpine linux with s6 overlay, for shell access whilst the container is running do `docker exec -it deluge /bin/bash`.
@@ -87,6 +89,7 @@ Change the downloads location in the webui in Preferences->Downloads and use /do
 
 ## Versions
 
++ **29.04.17:** Add variable for user defined umask.
 + **28.04.17:** update to libressl2.5-libssl.
 + **28.12.16:** Rebase to alpine 3.5 baseimage.
 + **17.11.16:** Rebase to edge baseimage.
diff --git a/root/etc/services.d/deluge-web/run b/root/etc/services.d/deluge-web/run
index 90bacae..7566762 100644
--- a/root/etc/services.d/deluge-web/run
+++ b/root/etc/services.d/deluge-web/run
@@ -1,6 +1,8 @@
 #!/usr/bin/with-contenv bash
 
-umask 022
+UMASK_SET=${UMASK_SET:-022}
+
+umask "$UMASK_SET"
 
 exec \
 	s6-setuidgid abc /usr/bin/deluge-web \
diff --git a/root/etc/services.d/deluged/run b/root/etc/services.d/deluged/run
index e01dfc4..00781cf 100644
--- a/root/etc/services.d/deluged/run
+++ b/root/etc/services.d/deluged/run
@@ -1,6 +1,8 @@
 #!/usr/bin/with-contenv bash
 
-umask 022
+UMASK_SET=${UMASK_SET:-022}
+
+umask "$UMASK_SET"
 
 exec \
 	s6-setuidgid abc /usr/bin/deluged -c /config \
-- 
GitLab