tags 433510 + patch
thanks

On Tue, 17 Jul 2007 09:31:19 -0700, Ben Armstrong wrote:

> We set MAIL_LOG=/var/log/maillog in /etc/default/mailgraph and upgraded.
> The local change was ignored and set to the value stored in debconf.
> This took down mailgraph for two days.  Unhappiness ensued.  Please fix.

The problem is that debian/config ignores /etc/default/mailgraph.
Unfortunately fixing debian/config is not enough because the old
debian/postrm uncoditionally removes /etc/default/mailgraph before
the new debian/config is called ...

The attached patch tries to cope with this situation by
1) removing /etc/default/mailgraph only on package purge
2) once saving the values from /etc/default/mailgraph in a new
   debian/preinst

Cheers,
gregor
-- 
 .''`.   http://info.comodo.priv.at/ | gpg key ID: 0x00F3CFE4
 : :' :  debian: the universal operating system - http://www.debian.org/
 `. `'   member of https://www.vibe.at/ | how to reply: http://got.to/quote/
   `-    NP: Rod Stewart
diff -u mailgraph-1.13/debian/changelog mailgraph-1.13/debian/changelog
--- mailgraph-1.13/debian/changelog
+++ mailgraph-1.13/debian/changelog
@@ -1,3 +1,11 @@
+mailgraph (1.13-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix "Local changes to /etc/default/mailgraph are overwritten" by using
+    the current configuration in debian/config (closes: #433510).
+
+ -- gregor herrmann <[EMAIL PROTECTED]>  Fri, 07 Sep 2007 03:28:51 +0200
+
 mailgraph (1.13-1) unstable; urgency=low
 
   * New upstream release.
diff -u mailgraph-1.13/debian/config mailgraph-1.13/debian/config
--- mailgraph-1.13/debian/config
+++ mailgraph-1.13/debian/config
@@ -1,5 +1,13 @@
 #!/bin/sh -e
 . /usr/share/debconf/confmodule
+
+if [ -f /etc/default/mailgraph ]; then
+	. /etc/default/mailgraph
+	db_set mailgraph/start_on_boot "$BOOT_START"
+	db_set mailgraph/mail_log "$MAIL_LOG"
+	db_set mailgraph/ignore_localhost "$IGNORE_LOCALHOST"
+fi
+	
 db_input medium mailgraph/start_on_boot || true
 db_go
 db_input medium mailgraph/mail_log || true
diff -u mailgraph-1.13/debian/postrm mailgraph-1.13/debian/postrm
--- mailgraph-1.13/debian/postrm
+++ mailgraph-1.13/debian/postrm
@@ -1,4 +1,9 @@
 #!/bin/sh
-rm -f /etc/default/mailgraph
+
+set -e
+
+if [ "$1" = "purge" ] ; then
+	rm -f /etc/default/mailgraph
+fi
 #DEBHELPER#
 exit 0
only in patch2:
unchanged:
--- mailgraph-1.13.orig/debian/preinst
+++ mailgraph-1.13/debian/preinst
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+
+
+case "$1" in
+    upgrade)
+    	if [ "$2" \< "1.13-1.1" ]; then
+        if [ -f /etc/default/mailgraph ]; then
+        	. /usr/share/debconf/confmodule
+          . /etc/default/mailgraph
+          db_set mailgraph/start_on_boot "$BOOT_START"
+          db_set mailgraph/mail_log "$MAIL_LOG"
+          db_set mailgraph/ignore_localhost "$IGNORE_LOCALHOST"
+        fi
+    	fi
+    ;;
+
+    install|abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+

Attachment: signature.asc
Description: Digital signature

Reply via email to