Control: tag -1 + patch

On Sun, 31 Jul 2011 21:29:24 +0100, Nicholas Bamber wrote:

> The upstream maradns install notes describe a very minimal
> config file. I think what we need to do is capture that minimal
> config in debconf and otherwise respect whatever is in found the config
> file. Of course if there is no config file we need to install
> one.

That sounds like a good way in the long run.

But there _might_ be an easier short-term option:
- If I understand the problem correctly, the packages currently ships
  /etc/maradns/mararc and modifies it in the postinst; but only on
  fresh installs;
- in this case it might be enough to
  + ship the "template" under a different name than
    /etc/maradns/mararc
  + do the fixup in postinst only on new installs (like now) _and_ if
    the file in /etc doesn't exist (as an additional precaution)

Find attached a quick patch which seems to work (as in: create
/etc/maradns/mararc on a new install and leave it alone for
upgrades). Of course the template could be put somewhere else, and
the nested conditions in the postinst written differently.

Hope that helps,
gregor

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Leonard Cohen: Different Sides
diff -Nru maradns-1.4.12/debian/changelog maradns-1.4.12/debian/changelog
--- maradns-1.4.12/debian/changelog	2012-06-08 22:38:28.000000000 +0200
+++ maradns-1.4.12/debian/changelog	2012-09-26 17:56:10.000000000 +0200
@@ -1,3 +1,14 @@
+maradns (1.4.12-3.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Fix "Debian default config is not robust to user change + upgrade":
+    - install template configuration file outside /etc
+    - make sure that it's created in /etc only for new installs and if it
+      doesn't exist
+    (Closes: #636158)
+
+ -- gregor herrmann <gre...@debian.org>  Wed, 26 Sep 2012 17:26:01 +0200
+
 maradns (1.4.12-3) unstable; urgency=low
 
   * Improved changelog parsing to work with binNMUs (Closes: #675392)
diff -Nru maradns-1.4.12/debian/maradns.install maradns-1.4.12/debian/maradns.install
--- maradns-1.4.12/debian/maradns.install	2012-02-02 10:50:22.000000000 +0100
+++ maradns-1.4.12/debian/maradns.install	2012-09-26 17:38:00.000000000 +0200
@@ -3,5 +3,5 @@
 tcp/fetchzone usr/sbin
 tcp/getzone usr/sbin
 server/maradns usr/sbin
-debian/mararc etc/maradns
+debian/mararc usr/share/maradns
 debian/maradns-insserv etc/insserv.conf.d
diff -Nru maradns-1.4.12/debian/postinst maradns-1.4.12/debian/postinst
--- maradns-1.4.12/debian/postinst	2012-02-02 10:50:22.000000000 +0100
+++ maradns-1.4.12/debian/postinst	2012-09-26 17:45:40.000000000 +0200
@@ -11,16 +11,17 @@
 
 mkdir -p /etc/maradns/logger
 
-if [ "$1" = "configure" ] && [ -f /etc/maradns/mararc ]
+if [ "$1" = "configure" ]
 then
 	IDNUM=`id -u maradns`
 	GIDNUM=`id -g maradns`
-	if [ "$2" = "" ] # we are doing fresh install
+	if [ "$2" = "" ] && [ ! -f /etc/maradns/mararc ] # we are doing fresh install
 	then
 		sed -e "s/^maradns_uid = .*$/maradns_uid = $IDNUM/" \
-			-e "s/^# maradns_gid = .*$/maradns_gid = $GIDNUM/" < /etc/maradns/mararc > /etc/maradns/mararc.tmp
+			-e "s/^# maradns_gid = .*$/maradns_gid = $GIDNUM/" < /usr/share/maradns/mararc > /etc/maradns/mararc.tmp
 		mv -f /etc/maradns/mararc.tmp /etc/maradns/mararc
-	else
+	elif [ -f /etc/maradns/mararc ]
+	then
 		grep -q "maradns_uid = $IDNUM" /etc/maradns/mararc || echo WARNING: "maradns_uid = $IDNUM" is missing from /etc/maradns/mararc
 	fi
 fi

Attachment: signature.asc
Description: Digital signature

Reply via email to