[Python-apps-commits] r671 - in packages/pypolicyd-spf/trunk/debian (3 files)

kitterma-guest at users.alioth.debian.org kitterma-guest at users.alioth.debian.org
Thu Feb 21 19:11:12 UTC 2008


    Date: Thursday, February 21, 2008 @ 19:11:10
  Author: kitterma-guest
Revision: 671

Add pre/postinst to move conffile.

Added:
  packages/pypolicyd-spf/trunk/debian/postfix-policyd-spf-python.postinst
  packages/pypolicyd-spf/trunk/debian/postfix-policyd-spf-python.preinst
Modified:
  packages/pypolicyd-spf/trunk/debian/changelog

Modified: packages/pypolicyd-spf/trunk/debian/changelog
===================================================================
--- packages/pypolicyd-spf/trunk/debian/changelog	2008-02-21 18:41:56 UTC (rev 670)
+++ packages/pypolicyd-spf/trunk/debian/changelog	2008-02-21 19:11:10 UTC (rev 671)
@@ -10,6 +10,8 @@
   * Update install-conf-fix.patch for new binary package name
   * Rename upstream man pages in debian/rules to match debian binary package
     name
+  * Add preint and postinst to move conffile to correct directory for new
+    package name
 
  -- Scott Kitterman <scott at kitterman.com>  Wed, 20 Feb 2008 17:35:02 -0500
 

Added: packages/pypolicyd-spf/trunk/debian/postfix-policyd-spf-python.postinst
===================================================================
--- packages/pypolicyd-spf/trunk/debian/postfix-policyd-spf-python.postinst	                        (rev 0)
+++ packages/pypolicyd-spf/trunk/debian/postfix-policyd-spf-python.postinst	2008-02-21 19:11:10 UTC (rev 671)
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+# Move a conffile without triggering a dpkg question
+mv_conffile() {
+    OLDCONFFILE="$1"
+    NEWCONFFILE="$2"
+
+    if [ -e "$OLDCONFFILE" ]; then
+        echo "Preserving user changes to $NEWCONFFILE ..."
+        if [ -n "/etc/postfix-policyd-spf-python/" ]; then
+            mkdir "/etc/postfix-policyd-spf-python/"
+        fi
+        mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
+        mv -f "$OLDCONFFILE" "$NEWCONFFILE"
+        rm -rf "/etc/python-policyd-spf/"
+    fi
+}
+
+case "$1" in
+configure)
+    if dpkg --compare-versions "$2" le "$LASTVERSION"; then
+        mv_conffile "/etc/python-policyd-spf/policyd-spf.conf" \
+          "/etc/postfix-policyd-spf-python/policyd-spf.conf"
+    fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+esac
+

Added: packages/pypolicyd-spf/trunk/debian/postfix-policyd-spf-python.preinst
===================================================================
--- packages/pypolicyd-spf/trunk/debian/postfix-policyd-spf-python.preinst	                        (rev 0)
+++ packages/pypolicyd-spf/trunk/debian/postfix-policyd-spf-python.preinst	2008-02-21 19:11:10 UTC (rev 671)
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+# Prepare to move a conffile without triggering a dpkg question
+prep_mv_conffile() {
+    CONFFILE="$1"
+
+    if [ -e "$CONFFILE" ]; then
+        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+        old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
+        if [ "$md5sum" = "$old_md5sum" ]; then
+            rm -f "/etc/python-policyd-spf"
+        fi
+    fi
+}
+
+case "$1" in
+install|upgrade)
+    if dpkg --compare-versions "$2" le "$LASTVERSION"; then
+        prep_mv_conffile "/etc/python-policyd-spf/policyd-spf.conf"
+    fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+esac




More information about the Python-apps-commits mailing list