tags 413397 -patch
thanks

The suggested patch is flawed.  There's no reason to limit update-inetd's
actions to cases when the postinst is called with 'configure'; the other
options for postinst are abort-upgrade, abort-remove, and abort-deconfigure,
and if the removal commands are going to be moved from postrm to prerm, then
the --add command needs to be invoked for *every* call of the postinst.

Now, if the removal /is/ done in the prerm, then without any changes to the
postinst we get as a bonus the fix that 'dpkg-reconfigure ifcico' no longer
generates an extra, commented-out entry every time it's called.  The
postinst is still not idempotent, though; if for any reason the postinst
should fail partway through, calling it again is going to create extra
commented-out entries for these services, because the postinst will comment
out the newly added entries from the /previous/ run and then proceed to add
new uncommented ones.

OTOH, there's the question of whether services should be stopped/disabled in
the prerm.  Doing so effectively means that any changes the local admin
makes to the inetd line will be lost on every package upgrade, which is not
desirable.

So the only way to preserve such changes reliably is to treat them the same
as conffiles: only install the entry on initial install of the package, only
remove the entry on package purge.  (Removing the entry on package removal
is insufficient unless we pre-depend on update-inetd, because the postinst
can't distinguish between an upgrade of the package and an install from
config-files state, so install-remove-install would leave the user without
inetd.conf entries.)

The attached patch therefore implements this last logic.  I'm leaving the
patch tag off for now, though; I'm not 100% happy with this solution because
it leaves the record in place and enabled on package removal.  It's possible
that a two-stage process, disable/enable vs. add/remove, would give better
results, but I need to think on that some more since there don't seem to be
any good examples of update-inetd use running around anywhere. :/  Anyway,
the attached patch would at least be an improvement over the current state
of affairs (IMHO) and resolve the RC bug, so Marco, feel free to use it if
you want it, I just won't NMU with this particular iteration.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
[EMAIL PROTECTED]                                   http://www.debian.org/
diff -u ifmail-2.14tx8.10/debian/ifcico.postinst ifmail-2.14tx8.10/debian/ifcico.postinst
--- ifmail-2.14tx8.10/debian/ifcico.postinst
+++ ifmail-2.14tx8.10/debian/ifcico.postinst
@@ -1,9 +1,11 @@
 #!/bin/sh -e
 
-update-inetd --comment-chars "#disabled#" --disable tfido
-update-inetd --group OTHER --add "tfido		stream	tcp	nowait	ftn	/usr/sbin/tcpd	/usr/lib/ifmail/ifcico -r 0 -t"
-update-inetd --comment-chars "#disabled#" --disable fido
-update-inetd --group OTHER --add "fido		stream	tcp	nowait  ftn	/usr/sbin/tcpd	/usr/lib/ifmail/ifcico -r 0"
+if [ "$1" = "configure" ] && [ -z "$2" ]; then
+	update-inetd --comment-chars "#disabled#" --disable tfido
+	update-inetd --group OTHER --add "tfido		stream	tcp	nowait	ftn	/usr/sbin/tcpd	/usr/lib/ifmail/ifcico -r 0 -t"
+	update-inetd --comment-chars "#disabled#" --disable fido
+	update-inetd --group OTHER --add "fido		stream	tcp	nowait  ftn	/usr/sbin/tcpd	/usr/lib/ifmail/ifcico -r 0"
+fi
 
 #DEBHELPER#
 
diff -u ifmail-2.14tx8.10/debian/changelog ifmail-2.14tx8.10/debian/changelog
--- ifmail-2.14tx8.10/debian/changelog
+++ ifmail-2.14tx8.10/debian/changelog
@@ -1,3 +1,13 @@
+ifmail (2.14tx8.10-19.2) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * High-urgency upload for RC bugfix.
+  * Add missing dependency on update-inetd to ifcico, and fix the 
+    maintainer script handling to only add entries on a new install and 
+    only remove them on purge.  Closes: #413397.
+
+ -- Steve Langasek <[EMAIL PROTECTED]>  Sun, 18 Mar 2007 01:42:26 -0700
+
 ifmail (2.14tx8.10-19.1) unstable; urgency=high
 
   * Non-maintainer upload.
diff -u ifmail-2.14tx8.10/debian/control ifmail-2.14tx8.10/debian/control
--- ifmail-2.14tx8.10/debian/control
+++ ifmail-2.14tx8.10/debian/control
@@ -23,7 +23,7 @@
 
 Package: ifcico
 Architecture: any
-Depends: ${shlibs:Depends}, ifmail
+Depends: ${shlibs:Depends}, ifmail, update-inetd
 Conflicts: suidmanager (<< 0.50)
 Description: Fidonet Technology transport package
  Ifcico is a FidoTech mailer for connecting to other nodes via the phone
diff -u ifmail-2.14tx8.10/debian/ifcico.postrm ifmail-2.14tx8.10/debian/ifcico.postrm
--- ifmail-2.14tx8.10/debian/ifcico.postrm
+++ ifmail-2.14tx8.10/debian/ifcico.postrm
@@ -1,11 +1,10 @@
 #!/bin/sh -e
 
-update-inetd --remove "^tfido"
-update-inetd --comment-chars "#disabled#" --enable tfido
-update-inetd --remove "^fido"
-update-inetd --comment-chars "#disabled#" --enable fido
-
 if [ "$1" = "purge" ]; then
+  update-inetd --remove "^tfido.*/usr/lib/ifmail/ifcico"
+  update-inetd --comment-chars "#disabled#" --enable tfido
+  update-inetd --remove "^fido.*/usr/lib/ifmail/ifcico"
+  update-inetd --comment-chars "#disabled#" --enable fido
   rm -rf /var/spool/ftn/nl.d/index.dir \
   /var/spool/ftn/nl.d/index.pag  >/dev/null
 fi

Reply via email to