[DRE-commits] [diaspora-installer] 01/02: Make ucf handle conffiles

Balasankar C balasankarc-guest at moszumanska.debian.org
Sat Mar 12 06:36:08 UTC 2016


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

balasankarc-guest pushed a commit to branch conffiles
in repository diaspora-installer.

commit 64a8caca3a41c0168a9687fd6cbf94f344f69856
Author: Balasankar C <balasankarc at autistici.org>
Date:   Sat Mar 12 12:05:36 2016 +0530

    Make ucf handle conffiles
---
 debian/diaspora-common.install  |   2 +-
 debian/diaspora-common.postinst |  32 +++++------
 debian/diaspora-common.postrm   | 115 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 133 insertions(+), 16 deletions(-)

diff --git a/debian/diaspora-common.install b/debian/diaspora-common.install
index 9023801..bd488ef 100644
--- a/debian/diaspora-common.install
+++ b/debian/diaspora-common.install
@@ -3,7 +3,7 @@ database.yml etc/diaspora
 diaspora-common.conf /etc/diaspora
 diaspora-download.sh usr/lib/diaspora-common/scripts
 diaspora-versions.sh usr/lib/diaspora-common/scripts
-diaspora.conf /etc
+diaspora.conf /usr/share/diaspora-common/
 diaspora.yml etc/diaspora
 grantpriv.sh usr/lib/diaspora-common/scripts
 rake-tasks.sh usr/lib/diaspora-common/scripts
diff --git a/debian/diaspora-common.postinst b/debian/diaspora-common.postinst
index 975fb6f..c37bc6c 100755
--- a/debian/diaspora-common.postinst
+++ b/debian/diaspora-common.postinst
@@ -71,11 +71,11 @@ case "$1" in
                 # Configure pod address.
                 db_get diaspora-common/url
                 echo "SSL disabled, skip nginx configuration for ${RET}..."
-                if ! grep SERVERNAME /etc/diaspora.conf
+                if ! grep SERVERNAME /usr/share/diaspora-common/diaspora.conf
                 then
-                    echo export SERVERNAME=${RET} >> /etc/diaspora.conf
+                    echo export SERVERNAME=${RET} >> /usr/share/diaspora-common/diaspora.conf
                     export SERVERNAME=${RET}
-                    echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> /etc/diaspora.conf
+                    echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> /usr/share/diaspora-common/diaspora.conf
                 fi
             fi
 
@@ -92,9 +92,9 @@ case "$1" in
                     facebook_app_id=$RET
                     db_get diaspora-common/facebook_secret
                     facebook_secret=$RET
-                    echo export SERVICES_FACEBOOK_ENABLE=true >> /etc/diaspora.conf
-                    echo export SERVICES_FACEBOOK_APP_ID=$facebook_app_id >> /etc/diaspora.conf
-                    echo export SERVICES_FACEBOOK_SECRET=$facebook_secret >> /etc/diaspora.conf
+                    echo export SERVICES_FACEBOOK_ENABLE=true >> /usr/share/diaspora-common/diaspora.conf
+                    echo export SERVICES_FACEBOOK_APP_ID=$facebook_app_id >> /usr/share/diaspora-common/diaspora.conf
+                    echo export SERVICES_FACEBOOK_SECRET=$facebook_secret >> /usr/share/diaspora-common/diaspora.conf
                 fi
                 servicename="Twitter"
                 if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
@@ -102,9 +102,9 @@ case "$1" in
                     twitter_key=$RET
                     db_get diaspora-common/twitter_secret
                     twitter_secret=$RET
-                    echo export SERVICES_TWITTER_ENABLE=true >> /etc/diaspora.conf
-                    echo export SERVICES_TWITTER_KEY=$twitter_key >> /etc/diaspora.conf
-                    echo export SERVICES_TWITTER_SECRET=$twitter_secret >> /etc/diaspora.conf
+                    echo export SERVICES_TWITTER_ENABLE=true >> /usr/share/diaspora-common/diaspora.conf
+                    echo export SERVICES_TWITTER_KEY=$twitter_key >> /usr/share/diaspora-common/diaspora.conf
+                    echo export SERVICES_TWITTER_SECRET=$twitter_secret >> /usr/share/diaspora-common/diaspora.conf
                 fi
                 servicename="Tumblr"
                 if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
@@ -112,9 +112,9 @@ case "$1" in
                     tumblr_key=$RET
                     db_get diaspora-common/tumblr_secret
                     tumblr_secret=$RET
-                    echo export SERVICES_TUMBLR_ENABLE=true >> /etc/diaspora.conf
-                    echo export SERVICES_TUMBLR_KEY=$tumblr_key >> /etc/diaspora.conf
-                    echo export SERVICES_TUMBLR_SECRET=$tumblr_secret >> /etc/diaspora.conf
+                    echo export SERVICES_TUMBLR_ENABLE=true >> /usr/share/diaspora-common/diaspora.conf
+                    echo export SERVICES_TUMBLR_KEY=$tumblr_key >> /usr/share/diaspora-common/diaspora.conf
+                    echo export SERVICES_TUMBLR_SECRET=$tumblr_secret >> /usr/share/diaspora-common/diaspora.conf
                 fi
                 servicename="Wordpress"
                 if [ "${selectedservices#*$servicename}" != "$selectedservices" ]; then
@@ -122,11 +122,13 @@ case "$1" in
                     wordpress_client_id=$RET
                     db_get diaspora-common/wordpress_secret
                     wordpress_secret=$RET
-                    echo export SERVICES_WORDPRESS_ENABLE=true >> /etc/diaspora.conf
-                    echo export SERVICES_WORDPRESS_CLIENT_ID=$wordpress_client_id >> /etc/diaspora.conf
-                    echo export SERVICES_WORDPRESS_SECRET=$wordpress_secret >> /etc/diaspora.conf
+                    echo export SERVICES_WORDPRESS_ENABLE=true >> /usr/share/diaspora-common/diaspora.conf
+                    echo export SERVICES_WORDPRESS_CLIENT_ID=$wordpress_client_id >> /usr/share/diaspora-common/diaspora.conf
+                    echo export SERVICES_WORDPRESS_SECRET=$wordpress_secret >> /usr/share/diaspora-common/diaspora.conf
                 fi
             fi
+            ucf /usr/share/diaspora-common/diaspora.conf /etc/diaspora.conf
+            ucfr diaspora-common /etc/diaspora.conf
             ${diaspora_scripts}/adduser.sh
             ${diaspora_scripts}/grantpriv.sh
             mkdir -p ${diaspora_nginx_log}
diff --git a/debian/diaspora-common.postrm b/debian/diaspora-common.postrm
new file mode 100644
index 0000000..4f479d4
--- /dev/null
+++ b/debian/diaspora-common.postrm
@@ -0,0 +1,115 @@
+#! /bin/sh
+# postrm.skeleton
+# Skeleton maintainer script showing all the possible cases.
+# Written by Charles Briscoe-Smith, March-June 1998.  Public Domain.
+
+# Abort if any command returns an error value
+set -e
+
+# This script is called twice during the removal of the package; once
+# after the removal of the package's files from the system, and as
+# the final step in the removal of this package, after the package's
+# conffiles have been removed.
+
+# Ensure the menu system is updated
+: [ ! -x /usr/bin/update-menus ] || /usr/bin/update-menus
+
+case "$1" in
+  remove)
+    # This package is being removed, but its configuration has not yet
+    # been purged.
+    :
+
+    # Remove diversion
+    : dpkg-divert --package diaspora-common --remove --rename \
+    :             --divert /usr/bin/other.real /usr/bin/other
+
+    # ldconfig is NOT needed during removal of a library, only during
+    # installation
+
+    ;;
+  purge)
+    # This package has previously been removed and is now having
+    # its configuration purged from the system.
+    :
+
+    # we mimic dpkg as closely as possible, so we remove configuration
+    # files with dpkg backup extensions too:
+    ### Some of the following is from Tore Anderson:
+    for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist;  do
+	rm -f /etc/diaspora.conf$ext
+    done
+ 
+    # remove the configuration file itself
+    rm -f /etc/diaspora.conf
+
+    # and finally clear it out from the ucf database
+    if which ucf >/dev/null; then
+        ucf --purge /etc/diaspora.conf
+    fi    
+    if which ucfr >/dev/null; then
+        ucfr --purge diaspora-common /etc/diaspora.conf
+    fi    
+
+    # Remove symlinks from /etc/rc?.d
+    : update-rc.d diaspora-common remove >/dev/null
+
+    ;;
+  disappear)
+    if test "$2" != overwriter; then
+      echo "$0: undocumented call to \`postrm $*'" 1>&2
+      exit 0
+    fi
+    # This package has been completely overwritten by package $3
+    # (version $4).  All our files are already gone from the system.
+    # This is a special case: neither "prerm remove" nor "postrm remove"
+    # have been called, because dpkg didn't know that this package would
+    # disappear until this stage.
+    :
+
+    ;;
+  upgrade)
+    # About to upgrade FROM THIS VERSION to version $2 of this package.
+    # "prerm upgrade" has been called for this version, and "preinst
+    # upgrade" has been called for the new version.  Last chance to
+    # clean up.
+    :
+
+    ;;
+  failed-upgrade)
+    # About to upgrade from version $2 of this package TO THIS VERSION.
+    # "prerm upgrade" has been called for the old version, and "preinst
+    # upgrade" has been called for this version.  This is only used if
+    # the previous version's "postrm upgrade" couldn't handle it and
+    # returned non-zero. (Fix old postrm bugs here.)
+    :
+
+    ;;
+  abort-install)
+    # Back out of an attempt to install this package.  Undo the effects of
+    # "preinst install...".  There are two sub-cases.
+    :
+
+    if test "${2+set}" = set; then
+      # When the install was attempted, version $2's configuration
+      # files were still on the system.  Undo the effects of "preinst
+      # install $2".
+      :
+
+    else
+      # We were being installed from scratch.  Undo the effects of
+      # "preinst install".
+      :
+
+    fi ;;
+  abort-upgrade)
+    # Back out of an attempt to upgrade this package from version $2
+    # TO THIS VERSION.  Undo the effects of "preinst upgrade $2".
+    :
+
+    ;;
+  *) echo "$0: didn't understand being called with \`$1'" 1>&2
+     exit 0;;
+esac
+
+exit 0

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