Lennart Poettering wrote:
> There's also mdns6 and mdns6_minimal for those IPv6-only-maniacs. You
> might want to check for them here, too. 

Ok.

> BTW, is this fragment executed on package upgrades, too? Would definitely 
> make a
> lot of sense.

It's run on upgrades from earlier versions and on new installs.

> Hmm. I think it would be a better idea to use "dns" as the single
> anchor for our changes, instead of "files" and for the end of the
> list.

Ok, good thought, I'll make that change.

> I am no Perl guru. However, as I understand this, you strip all
> occurances of [NOTFOUND=return] from the line. That is a really bad
> idea. That syntax might appear in other contexts too, since it is just
> a string to make sure that the previously called NSS module is made
> authoritative. That might be used by LDAP setups and others, too,
> not just nss-mdns.

I wondered about that.

Here's my updated patch.

-- 
see shy jo
diff --new-file -ur old/nss-mdns-0.8/debian/README.Debian 
nss-mdns-0.8/debian/README.Debian
--- old/nss-mdns-0.8/debian/README.Debian       2006-10-04 21:31:44.000000000 
-0400
+++ nss-mdns-0.8/debian/README.Debian   2006-10-04 21:31:58.000000000 -0400
@@ -2,43 +2,23 @@
 MODIFYING /etc/nsswitch.conf
 ----------------------------
 
-Previously the base-files package shipped /etc/nsswitch.conf and specified:
+/etc/nsswitch.conf is modified when this package is installed, to make mdns
+be used. The hosts line is changed to look like this:
 
-hosts:          files dns mdns
+hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
 
-However, due to bug#351990, this is no longer the case. /etc/nsswitch.conf
-is now generated post-installation. At this time this package does not
-modify /etc/nsswitch.conf (it will in future -- patches welcome).
-
-This means that, for now, you should modify /etc/nsswitch.conf yourself
-and set the hosts: line to be:
-
-hosts: files mdns_minimal dns mdns
-
-WHAT ABOUT UPSTREAM?
---------------------
-
-Upstream recommends a slightly different line, which make mDNS authoriative
-for both the .local, 169.254.0.0/16 and fe80::/16 zones. This means that
-local administrators do not have the opprotunity to insert entries into
-any of those zones (unlikely but possible).
-
-Additionally, using the recommended upstream line can cause interaction
-issues with whois and incorrectly configured Windows installations (not
-surprisingly many "enterprises" use .local for their internal servers).
+If you prefer a different setup, you can modify this line, and your changes
+will be preserved. If this package is purged, the mdns items will be
+removed from the hosts line.
 
 WHAT ABOUT IPv6?
 ----------------
 
-mDNS (multicast DNS) has been widely deployed within the Apple
-community (since Mac OS X 10.1) and by many printer manufacturers.
-
-Initially the mDNS entries only contained IPv4 addresses, however,
-since Mac OS X 10.3 onwards, mDNS entries have also been populated with
-IPv6 addresses.
+To support ipv6, edit /etc/nsswitch.conf and change it to a line such as
+this:
 
-Therefore Debian, once again, differs from upstream by recommending
-an entry which looks up addresses via both IPv4 and IPv6.
+hosts: files mdns_minimal [NOTFOUND=return] dns mdns
 
--- Anand Kumria <[EMAIL PROTECTED]>, Sun, 2 Jul 2006 21:36:18 +1000
+Note that this can result in delays when resolving mDNS names.
 
+ -- Joey Hess <[EMAIL PROTECTED]>  Wed,  4 Oct 2006 18:42:48 -0400
diff --new-file -ur old/nss-mdns-0.8/debian/changelog 
nss-mdns-0.8/debian/changelog
--- old/nss-mdns-0.8/debian/changelog   2006-10-04 21:31:44.000000000 -0400
+++ nss-mdns-0.8/debian/changelog       2006-10-04 21:42:17.000000000 -0400
@@ -1,3 +1,20 @@
+nss-mdns (0.8-4.2) unstable; urgency=low
+
+  * NMU
+  * Add postinst that will add mdns entries to /etc/nsswitch.conf on new
+    installs and on upgrades from the previous version.
+    Closes: #388864, #351990
+  * Add postrm to remove mdns entries from /etc/nsswitch.conf when the package
+    is removed.
+  * Local modifications to the file will be preserved accross upgrades.
+  * Depend on base-files 3.1.10 or higher to get a nsswitch.conf that is not a
+    conffile and that doesn't have mdns entries from base-files in it.
+  * Switch to nsswitch line recommended by upstream in #388864 after getting
+    clarification from upstream, and update README.Debian.
+  * Remove recommends on zeroconf. Closes: #353131
+
+ -- Joey Hess <[EMAIL PROTECTED]>  Fri, 22 Sep 2006 21:10:25 -0400
+
 nss-mdns (0.8-4.1) unstable; urgency=low
 
   * NMU
diff --new-file -ur old/nss-mdns-0.8/debian/control nss-mdns-0.8/debian/control
--- old/nss-mdns-0.8/debian/control     2006-10-04 21:31:44.000000000 -0400
+++ nss-mdns-0.8/debian/control 2006-10-04 21:31:59.000000000 -0400
@@ -7,10 +7,9 @@
 
 Package: libnss-mdns
 Section: admin
-Recommends: zeroconf
 Suggests: avahi-daemon
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, base-files (>= 3.1.10)
 Description: NSS module for Multicast DNS name resolution
  nss-mdns is a plugin for the GNU Name Service Switch (NSS) functionality
  of the GNU C Library (glibc) providing host name resolution via Multicast
diff --new-file -ur old/nss-mdns-0.8/debian/postinst 
nss-mdns-0.8/debian/postinst
--- old/nss-mdns-0.8/debian/postinst    1969-12-31 19:00:00.000000000 -0500
+++ nss-mdns-0.8/debian/postinst        2006-10-04 21:46:27.000000000 -0400
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+#DEBHELPER#
+
+if [ "$1" = configure ] && [ -e /etc/nsswitch.conf ]; then
+       if [ -z "$2" ] || dpkg --compare-versions "$2" le 0.8-4.1; then
+               perl -i -pe '
+                       sub insert {
+                               my @bits=split(" ", shift);
+                               if (grep { $_ eq "mdns4_minimal" || $_ eq 
"mdns4"
+                                       || $_ eq "mdns" || $_ eq "mdns_minimal" 
+                                       || $_ eq "mdns6" || $_ eq 
"mdns6_minimal"} @bits) {
+                                       return join " ", @bits;
+                               }
+                               return join " ", map {
+                                       $_ eq "dns" ? 
("mdns4_minimal","[NOTFOUND=return]",$_,"mdns4") : $_
+                               } @bits;
+                       }
+                       s/^(hosts:\s+)(.*)/$1.insert($2)/e;
+               ' /etc/nsswitch.conf
+       fi
+fi
diff --new-file -ur old/nss-mdns-0.8/debian/postrm nss-mdns-0.8/debian/postrm
--- old/nss-mdns-0.8/debian/postrm      1969-12-31 19:00:00.000000000 -0500
+++ nss-mdns-0.8/debian/postrm  2006-10-04 21:45:54.000000000 -0400
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+#DEBHELPER#
+
+if [ "$1" = purge ] && [ -e /etc/nsswitch.conf ]; then
+       perl -i -pe '
+               my @remove=(
+                       "mdns4_minimal [NOTFOUND=return]",
+                       "mdns4_minimal",
+                       "mdns4",
+                       "mdns6_minimal [NOTFOUND=return]",
+                       "mdns6_minimal",
+                       "mdns6",
+                       "mdns_minimal [NOTFOUND=return]",
+                       "mdns_minimal",
+                       "mdns",
+               );
+               sub remove {
+                       my $s=shift;
+                       foreach my $bit (@remove) {
+                               $s=~s/\s+\Q$bit\E//g;
+                       }
+                       return $s;
+               }
+               s/^(hosts:)(.*)/$1.remove($2)/e;
+       ' /etc/nsswitch.conf
+fi

Attachment: signature.asc
Description: Digital signature

Reply via email to