[DRE-commits] [diaspora-installer] 04/05: fix the way variable is written to config file

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Wed Apr 26 13:08:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository diaspora-installer.

commit d2fed69db1ff7286c0b2de076ff2d4cbc7bc2ca3
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Wed Apr 26 18:36:44 2017 +0530

    fix the way variable is written to config file
---
 debian/diaspora-common.config   |  2 +-
 debian/diaspora-common.postinst | 28 ++++++++--------------------
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/debian/diaspora-common.config b/debian/diaspora-common.config
index 22511d7..02fbf49 100644
--- a/debian/diaspora-common.config
+++ b/debian/diaspora-common.config
@@ -16,7 +16,7 @@ set -e
       # Store values from config file into
       # debconf db.
       db_set diaspora-common/url "$SERVERNAME"
-      db_set diaspora-common/ssl "$diaspora_https:-true"
+      db_set diaspora-common/ssl "${diaspora_https:-true}"
       db_set diaspora-common/letsencrypt "${diaspora_letsencrypt:-false}"
   fi
 
diff --git a/debian/diaspora-common.postinst b/debian/diaspora-common.postinst
index 57bd202..8e42b25 100755
--- a/debian/diaspora-common.postinst
+++ b/debian/diaspora-common.postinst
@@ -63,8 +63,14 @@ case "$1" in
     cp -a -f ${diaspora_conf_private} ${diaspora_conf_private}.tmp
 
     # Read from debconf db
+    db_get diaspora-common/url
+    SERVERNAME=${RET}
     db_get diaspora-common/ssl
     diaspora_https=$RET
+    ENVIRONMENT_URL=https://$SERVERNAME
+    if [ "$diaspora_https" = "false" ]; then
+      ENVIRONMENT_URL=http://$SERVERNAME
+    fi
     db_get diaspora-common/letsencrypt
     diaspora_letsencrypt=$RET
 
@@ -82,23 +88,10 @@ case "$1" in
             < ${diaspora_conf_private} > ${diaspora_conf_private}.tmp
         mv -f ${diaspora_conf_private}.tmp ${diaspora_conf_private}
 
-	    # Configure pod address.
-    db_get diaspora-common/url
-    export SERVERNAME=${RET}
-    if ! grep SERVERNAME ${diaspora_conf_private}
-      then
-        echo export SERVERNAME=${SERVERNAME} >> ${diaspora_conf_private}
-    fi
- 
     # Get ssl choice
     db_get diaspora-common/ssl
     if [ "${RET}" = "true" ]; then
         db_go
-        # Configure pod address.
-        if ! grep ENVIRONMENT_URL ${diaspora_conf_private}
-        then
-            echo export ENVIRONMENT_URL="https://$SERVERNAME" >> ${diaspora_conf_private}
-        fi
         # Configure nginx if available
         if which nginx > /dev/null 2>&1; then
             echo "SSL enabled, configuring nginx for ${SERVERNAME}..."
@@ -110,8 +103,7 @@ case "$1" in
         db_go
 
         # Check if letsencrypt option is selected
-        db_get diaspora-common/letsencrypt
-        if [ "${RET}" = "true" ]; then
+        if [ "$diaspora_letsencrypt" = "true" ]; then
 	  echo "Configuring letsencrypt..."
           mkdir -p /etc/diaspora/ssl
           ln -sf /etc/letsencrypt/live/${SERVERNAME}/fullchain.pem \
@@ -128,7 +120,7 @@ case "$1" in
 	      echo "Stopping nginx for letsencrypt..."
 	      invoke-rc.d nginx stop
 	    fi
-	    letsencrypt -d ${SERVERNAME} certonly || {
+	    letsencrypt --standalone -d ${SERVERNAME} certonly || {
 	    echo "letsencrypt auto configuration failed..."
 	    echo "Stop your webserver and try running letsencrypt manually..."
 	    echo "letsencrypt -d ${SERVERNAME} certonly"
@@ -146,10 +138,6 @@ case "$1" in
         else
             echo "nginx not installed, skipping configuration..."
         fi
-        if ! grep ENVIRONMENT_URL ${diaspora_conf_private}
-        then
-            echo export ENVIRONMENT_URL="http://$SERVERNAME" >> ${diaspora_conf_private}
-        fi
     fi
 
     # Check if user want to connect to some third party services

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/diaspora-installer.git



More information about the Pkg-ruby-extras-commits mailing list