From a14781337fa66025564a6ed5dd382771bf7e0091 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Sun, 13 May 2018 19:42:03 +0100
Subject: [PATCH] Ensure correct permissions on data directory during upgrades

---
 src/freedombone-app-privatebin | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/freedombone-app-privatebin b/src/freedombone-app-privatebin
index b76975541..c579266bf 100755
--- a/src/freedombone-app-privatebin
+++ b/src/freedombone-app-privatebin
@@ -154,15 +154,16 @@ function reconfigure_privatebin {
 }
 
 function upgrade_privatebin {
+    if grep -q "privatebin domain" "$COMPLETION_FILE"; then
+        PRIVATEBIN_DOMAIN_NAME=$(get_completion_param "privatebin domain")
+    fi
+    chmod 755 "/var/www/$PRIVATEBIN_DOMAIN_NAME/htdocs/data"
+
     CURR_PRIVATEBIN_COMMIT=$(get_completion_param "privatebin commit")
     if [[ "$CURR_PRIVATEBIN_COMMIT" == "$PRIVATEBIN_COMMIT" ]]; then
         return
     fi
 
-    if grep -q "privatebin domain" "$COMPLETION_FILE"; then
-        PRIVATEBIN_DOMAIN_NAME=$(get_completion_param "privatebin domain")
-    fi
-
     # update to the next commit
     function_check set_repo_commit
     set_repo_commit "/var/www/$PRIVATEBIN_DOMAIN_NAME/htdocs" "privatebin commit" "$PRIVATEBIN_COMMIT" "$PRIVATEBIN_REPO"
-- 
GitLab