From ca5a301a4fa02b1d132b4582a4373bad1f2cfc3c Mon Sep 17 00:00:00 2001
From: kytv <kytv@mail.i2p>
Date: Thu, 7 Nov 2013 19:56:01 +0000
Subject: [PATCH] i2prouter: create i2p.dir.config with umask from
 wrapper.config

---
 installer/resources/i2prouter | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/installer/resources/i2prouter b/installer/resources/i2prouter
index e614bd7e75..5df057f9bd 100644
--- a/installer/resources/i2prouter
+++ b/installer/resources/i2prouter
@@ -899,10 +899,14 @@ waitforwrapperstop() {
 }
 
 create_config_dir() {
-    if ! mkdir -p "$I2P_CONFIG_DIR"; then
-        echo "Error creating $I2P_CONFIG_DIR! Edit $0 and set I2P_CONFIG_DIR" >&2
-        echo "to the correct location." >&2
-        exit 1
+    if [ ! -d "$I2P_CONFIG_DIR" ]; then
+        UMASK=$(awk -F'=' '/^ *wrapper\.umask/{print $2}' $WRAPPER_CONF)
+        umask $UMASK
+        if ! mkdir -p "$I2P_CONFIG_DIR"; then
+            echo "Error creating $I2P_CONFIG_DIR! Edit $0 and set I2P_CONFIG_DIR" >&2
+            echo "to the correct location." >&2
+            exit 1
+        fi
     fi
 }
 
-- 
GitLab