[DRE-commits] [diaspora-installer] 09/15: always run postinst

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Tue Sep 27 13:55:07 UTC 2016


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

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

commit 98c61c25e2292d36da04fcca47bff6be9320c212
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Tue Sep 27 17:30:43 2016 +0530

    always run postinst
---
 debian/changelog                |   1 +
 debian/diaspora-common.postinst | 225 +++++++++++++++++++---------------------
 2 files changed, 109 insertions(+), 117 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 361f330..a90dc5e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ diaspora-installer (0.6.0.0+debian3) UNRELEASED; urgency=medium
   * Remove database.yml on purge
   * Remove leftover files on uninstallation/purge
   * Use /etc/nginx/sites-available/diaspora as nginx conf file
+  * Always run postinst (not just for updates)
 
  -- Pirate Praveen <praveen at debian.org>  Tue, 27 Sep 2016 09:15:31 +0530
 
diff --git a/debian/diaspora-common.postinst b/debian/diaspora-common.postinst
index 037d148..3501929 100755
--- a/debian/diaspora-common.postinst
+++ b/debian/diaspora-common.postinst
@@ -27,131 +27,122 @@ set -e
 
 
 case "$1" in
-    configure)
-        # Source varibales
-        . /etc/diaspora/diaspora-common.conf
+  configure)
+    # Source varibales
+    . /etc/diaspora/diaspora-common.conf
 
-        # Create private copy of diaspora.conf from example
-        mkdir -p /var/lib/diaspora-common
-	test -f ${diaspora_conf_private} ||\
-	cp ${diaspora_conf_example} ${diaspora_conf_private}
+    # Create private copy of diaspora.conf from example
+    mkdir -p /var/lib/diaspora-common
+    test -f ${diaspora_conf_private} ||\
+    cp ${diaspora_conf_example} ${diaspora_conf_private}
 
-        # Check if there is another version installed
-        if ! test -z $2
-        then
-            # Evaluate major and minor versions of diaspora
-            . /usr/lib/diaspora-common/scripts/diaspora-versions.sh
-            if test $(echo "${installed_diaspora_major_version} < 0.5" |bc) -eq 1
-            then
-                # Show debconf questions
-                . /usr/share/debconf/confmodule
-                echo "Be ready for long running database migrations..."
-            else
-                if test $(echo "${installed_diaspora_minor_version} < ${diaspora_minor_version}" |bc) -eq 1
-                then
-                    echo "Trying update from ${installed_diaspora_version}..."
-                fi
-            fi
-
-        else
-            # Show debconf questions
-            . /usr/share/debconf/confmodule
-            . /usr/share/dbconfig-common/dpkg/postinst
+    # Show debconf questions
+    . /usr/share/debconf/confmodule
+    . /usr/share/dbconfig-common/dpkg/postinst
 
-            dbc_go diaspora-common "$@"
-             
+    dbc_go diaspora-common "$@"
+     
 	    # 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
+    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
-                echo "SSL enabled, configuring nginx for ${SERVERNAME}..."
-                /usr/lib/diaspora-common/scripts/set-env-nginx.sh ${SERVERNAME}
-                db_go
-            else
-                db_go
-                # Configure pod address.
-                db_get diaspora-common/url
-                echo "SSL disabled, skip nginx configuration for ${RET}..."
-                if ! grep ENVIRONMENT_URL ${diaspora_conf_private}
-                then
-                    echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> ${diaspora_conf_private}
-                fi
-            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
+        echo "SSL enabled, configuring nginx for ${SERVERNAME}..."
+        /usr/lib/diaspora-common/scripts/set-env-nginx.sh ${SERVERNAME}
+        db_go
+    else
+        db_go
+        # Configure pod address.
+        db_get diaspora-common/url
+        echo "SSL disabled, skip nginx configuration for ${RET}..."
+        if ! grep ENVIRONMENT_URL ${diaspora_conf_private}
+        then
+            echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> ${diaspora_conf_private}
+        fi
+    fi
 
-            # Check if user want to connect to some third party services
-            db_get diaspora-common/services
-            echo "Services List"
-            selectedservices=$RET
-            echo $selectedservices
-            if [ "$RET" != "" ]; then
-                #Check if Facebook is selected
-                servicename="Facebook"
-                if [ "${selectedservices#*$servicename}" != "$RET" ]; then
-                    db_get diaspora-common/facebook_app_id
-                    facebook_app_id=$RET
-                    db_get diaspora-common/facebook_secret
-                    facebook_secret=$RET
-                    echo export SERVICES_FACEBOOK_ENABLE=true >> ${diaspora_conf_private}
-                    echo export SERVICES_FACEBOOK_APP_ID=$facebook_app_id >> ${diaspora_conf_private}
-                    echo export SERVICES_FACEBOOK_SECRET=$facebook_secret >> ${diaspora_conf_private}
-                fi
-                servicename="Twitter"
-                if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
-                    db_get diaspora-common/twitter_key
-                    twitter_key=$RET
-                    db_get diaspora-common/twitter_secret
-                    twitter_secret=$RET
-                    echo export SERVICES_TWITTER_ENABLE=true >> ${diaspora_conf_private}
-                    echo export SERVICES_TWITTER_KEY=$twitter_key >> ${diaspora_conf_private}
-                    echo export SERVICES_TWITTER_SECRET=$twitter_secret >> ${diaspora_conf_private}
-                fi
-                servicename="Tumblr"
-                if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
-                    db_get diaspora-common/tumblr_key
-                    tumblr_key=$RET
-                    db_get diaspora-common/tumblr_secret
-                    tumblr_secret=$RET
-                    echo export SERVICES_TUMBLR_ENABLE=true >> ${diaspora_conf_private}
-                    echo export SERVICES_TUMBLR_KEY=$tumblr_key >> ${diaspora_conf_private}
-                    echo export SERVICES_TUMBLR_SECRET=$tumblr_secret >> ${diaspora_conf_private}
-                fi
-                servicename="Wordpress"
-                if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
-                    db_get diaspora-common/wordpress_client_id
-                    wordpress_client_id=$RET
-                    db_get diaspora-common/wordpress_secret
-                    wordpress_secret=$RET
-                    echo export SERVICES_WORDPRESS_ENABLE=true >> ${diaspora_conf_private}
-                    echo export SERVICES_WORDPRESS_CLIENT_ID=$wordpress_client_id >> ${diaspora_conf_private}
-                    echo export SERVICES_WORDPRESS_SECRET=$wordpress_secret >> ${diaspora_conf_private}
-                fi
-            fi
-            ${diaspora_scripts}/adduser.sh
-            ${diaspora_scripts}/grantpriv.sh
+    # Check if user want to connect to some third party services
+    db_get diaspora-common/services
+    echo "Services List"
+    selectedservices=$RET
+    echo $selectedservices
+    if [ "$RET" != "" ]; then
+      #Check if Facebook is selected
+      servicename="Facebook"
+      if [ "${selectedservices#*$servicename}" != "$RET" ]; then
+        if ! grep SERVICES_FACEBOOK_ ${diaspora_conf_private}; then
+          db_get diaspora-common/facebook_app_id
+          facebook_app_id=$RET
+          db_get diaspora-common/facebook_secret
+          facebook_secret=$RET
+          echo export SERVICES_FACEBOOK_ENABLE=true >> ${diaspora_conf_private}
+          echo export SERVICES_FACEBOOK_APP_ID=$facebook_app_id >> ${diaspora_conf_private}
+          echo export SERVICES_FACEBOOK_SECRET=$facebook_secret >> ${diaspora_conf_private}
+        fi
+      fi
+      servicename="Twitter"
+      if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
+        if ! grep SERVICES_TWITTER_ ${diaspora_conf_private}; then
+          db_get diaspora-common/twitter_key
+          twitter_key=$RET
+          db_get diaspora-common/twitter_secret
+          twitter_secret=$RET
+          echo export SERVICES_TWITTER_ENABLE=true >> ${diaspora_conf_private}
+          echo export SERVICES_TWITTER_KEY=$twitter_key >> ${diaspora_conf_private}
+          echo export SERVICES_TWITTER_SECRET=$twitter_secret >> ${diaspora_conf_private}
+        fi
+      fi
+      servicename="Tumblr"
+      if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
+        if ! grep SERVICES_TUMBLR_ ${diaspora_conf_private}; then
+          db_get diaspora-common/tumblr_key
+          tumblr_key=$RET
+          db_get diaspora-common/tumblr_secret
+          tumblr_secret=$RET
+          echo export SERVICES_TUMBLR_ENABLE=true >> ${diaspora_conf_private}
+          echo export SERVICES_TUMBLR_KEY=$tumblr_key >> ${diaspora_conf_private}
+          echo export SERVICES_TUMBLR_SECRET=$tumblr_secret >> ${diaspora_conf_private}
+        fi
+      fi
+      servicename="Wordpress"
+      if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
+       if grep ! SERVICES_WORDPRESS_ ${diaspora_conf_private}; then
+          db_get diaspora-common/wordpress_client_id
+          wordpress_client_id=$RET
+          db_get diaspora-common/wordpress_secret
+          wordpress_secret=$RET
+          echo export SERVICES_WORDPRESS_ENABLE=true >> ${diaspora_conf_private}
+          echo export SERVICES_WORDPRESS_CLIENT_ID=$wordpress_client_id >> ${diaspora_conf_private}
+          echo export SERVICES_WORDPRESS_SECRET=$wordpress_secret >> ${diaspora_conf_private}
+        fi
+      fi
+    fi
+    ${diaspora_scripts}/adduser.sh
+    ${diaspora_scripts}/grantpriv.sh
 	    echo "Registering ${diaspora_conf} via ucf"
-            ucf --debconf-ok --three-way ${diaspora_conf_private} ${diaspora_conf}
-            ucfr diaspora-common ${diaspora_conf}
-            ucf --debconf-ok --three-way ${diaspora_database_yml_private} ${diaspora_database_yml}
-            ucfr diaspora-common ${diaspora_database_yml}
-            mkdir -p ${diaspora_nginx_log}
-            mkdir -p ${diaspora_home}
-            chown -R ${diaspora_user}: ${diaspora_home}
-            db_stop
+    ucf --debconf-ok --three-way ${diaspora_conf_private} ${diaspora_conf}
+    ucfr diaspora-common ${diaspora_conf}
+    ucf --debconf-ok --three-way ${diaspora_database_yml_private} ${diaspora_database_yml}
+    ucfr diaspora-common ${diaspora_database_yml}
+    mkdir -p ${diaspora_nginx_log}
+    mkdir -p ${diaspora_log_dir}
+    mkdir -p ${diaspora_home}
+    chown -R ${diaspora_user}: ${diaspora_home}
+    chown -R ${diaspora_user}: ${diaspora_log_dir}
+    db_stop
 
-        fi
         ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

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