[DRE-commits] [diaspora-installer] 03/05: update config in case value changed

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 208ef43fd7cae5d1c6967813c7b0d15d2643c057
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Wed Apr 26 18:10:01 2017 +0530

    update config in case value changed
---
 debian/diaspora-common.postinst | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/debian/diaspora-common.postinst b/debian/diaspora-common.postinst
index a691293..57bd202 100755
--- a/debian/diaspora-common.postinst
+++ b/debian/diaspora-common.postinst
@@ -59,7 +59,29 @@ case "$1" in
     cp ${diaspora_conf_example} ${diaspora_conf_private}
 
     dbc_go diaspora-common "$@"
-     
+
+    cp -a -f ${diaspora_conf_private} ${diaspora_conf_private}.tmp
+
+    # Read from debconf db
+    db_get diaspora-common/ssl
+    diaspora_https=$RET
+    db_get diaspora-common/letsencrypt
+    diaspora_letsencrypt=$RET
+
+    # If the admin deleted or commented some variables but then set
+    # them via debconf, (re-)add them to the conffile.
+    test -z "$SERVERNAME" || grep -Eq '^ *SERVERNAME=' ${diaspora_conf_private} || \
+        echo "SERVERNAME=" >> ${diaspora_conf_private}
+    test -z "$diaspora_https" || grep -Eq '^ *diaspora_https=' ${diaspora_conf_private} || \
+        echo "diaspora_https=" >> ${diaspora_conf_private}
+    test -z "$diaspora_letsencrypt" || grep -Eq '^ *diaspora_letsencrypt=' ${diaspora_conf_private} || \
+        echo "diaspora_letsencrypt=" >> ${diaspora_conf_private}
+    sed -e "s/^ *SERVERNAME=.*/SERVERNAME=\"$SERVERNAME\"/" \
+        -e "s/^ *diaspora_https=.*/diaspora_https=\"$diaspora_https\"/" \
+        -e "s/^ *diaspora_letsencrypt=.*/diaspora_letsencrypt=\"$diaspora_letsencrypt\"/" \
+            < ${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}

-- 
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