-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tags 503713 patch
thanks

José Luis Tallón wrote:
> I look forward to your suggestion and/or patch.

Time did not allow me to finish this yesterday, but I managed to finish
up testing the patch today.

I've attached my proposed patch: <bindgraph-bug-503713.patch>

It sources the /etc/default/bindgraph in debian/config if it exists and
uses the DNS_LOG value to set the selection in debconf before prompting.

It also uses a more strict expression to check if the
/etc/default/bindgraph needs to be modified.

mailgraph uses as similar approach, except that it uses all debconf
questions to generate /etc/default/mailgraph and sources it to set the
current values in debconf for all mailgraphs questions. This may be an
option too, this was my initial approach, but that patch deferred to
much from your package as it is now, so I chose this more limited
approach for now.

You probably also want to purge the settings from the debconf database
in debian/postrm with db_purge to start fresh after the package has been
purged.

Regards,

Bas

- --
GnuPG: 0x77A975AD
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkRs6cACgkQRWRRA3epda2UOgCgibWgu6HzMqRyRXVYzJYEhAOw
u44An1oM/3bPEdqGRzcq/o/toPtOCw3a
=dL5g
-----END PGP SIGNATURE-----
diff -ruN ../bindgraph-0.2a.old/debian/changelog ../bindgraph-0.2a/debian/changelog
--- ../bindgraph-0.2a.old/debian/changelog	2008-11-04 16:53:40.000000000 +0100
+++ ../bindgraph-0.2a/debian/changelog	2008-11-04 16:40:13.000000000 +0100
@@ -1,3 +1,12 @@
+bindgraph (0.2a-3.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Change maintainer scripts to preserve changes to /etc/default/bindgraph
+    by using those settings (if available) in debconf before prompting.
+    (Closes: 503713)
+
+ -- Sebastiaan Couwenberg <[EMAIL PROTECTED]>  Tue, 04 Nov 2008 16:27:47 +0100
+
 bindgraph (0.2a-3.1) unstable; urgency=low
 
   * Non-maintainer upload.
diff -ruN ../bindgraph-0.2a.old/debian/config ../bindgraph-0.2a/debian/config
--- ../bindgraph-0.2a.old/debian/config	2008-11-04 16:53:40.000000000 +0100
+++ ../bindgraph-0.2a/debian/config	2008-11-05 15:26:51.000000000 +0100
@@ -12,7 +12,14 @@
 
 case "$1" in
         configure|reconfigure)
- 
+		if [ -f /etc/default/bindgraph ]; then
+			. /etc/default/bindgraph
+
+			if [ -n "$DNS_LOG" ]; then
+				db_set bindgraph/logfile "$DNS_LOG"
+			fi
+		fi 		
+
 		db_input medium bindgraph/start_on_boot || true
 		db_go
 
diff -ruN ../bindgraph-0.2a.old/debian/postinst ../bindgraph-0.2a/debian/postinst
--- ../bindgraph-0.2a.old/debian/postinst	2008-11-04 16:53:40.000000000 +0100
+++ ../bindgraph-0.2a/debian/postinst	2008-11-05 15:27:05.000000000 +0100
@@ -60,18 +60,19 @@
 	if [ ! -f $DEFAULTS ]; then
 		echo "DNS_LOG=$LOGFILE" > $DEFAULTS
 		echo "LOG_FORMAT=${log_ver}" >> $DEFAULTS
-		
-	elif [ -z "`grep $LOGFILE $DEFAULTS`" ]; then
+	fi
+	
+	if [ -z "`egrep "^\s*DNS_LOG\s*=\s*$LOGFILE\s*$" $DEFAULTS`" ]; then
 		# update log file location
 		mv $DEFAULTS $DEFAULTS.tmp
-		grep -v DNS_LOG $DEFAULTS.tmp > $DEFAULTS
+		egrep -v "^\s*DNS_LOG\s*=" $DEFAULTS.tmp > $DEFAULTS
 		echo "DNS_LOG=$LOGFILE" >> $DEFAULTS
 		rm -f $DEFAULTS.tmp
 	fi
 	
 	if [ -n "$2" ]; then
 		# if we are upgrading, update config :-)
-		if [ -z "`grep LOG_FORMAT ${DEFAULTS}`" ]; then
+		if [ -z "`egrep "^\s*LOG_FORMAT\s*=" ${DEFAULTS}`" ]; then
 			echo "LOG_FORMAT=${log_ver}" >> $DEFAULTS		
 		fi
 	fi

Reply via email to