From a6384edcad6a74d2efb7ca6e72218b7ab3119b24 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 25 Jun 2007 20:12:47 +0000 Subject: [PATCH] initial import --- .cvsignore | 1 + nss-mdns.spec | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 129 insertions(+) create mode 100644 nss-mdns.spec diff --git a/.cvsignore b/.cvsignore index e69de29..f711b42 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +nss-mdns-0.10.tar.gz diff --git a/nss-mdns.spec b/nss-mdns.spec new file mode 100644 index 0000000..a764495 --- /dev/null +++ b/nss-mdns.spec @@ -0,0 +1,127 @@ +Summary: glibc plugin for .local name resolution +Name: nss-mdns +Version: 0.10 +Release: 2%{?dist} +License: LGPL +URL: http://0pointer.de/lennart/projects/nss-mdns/ +Group: System Environment/Libraries +Source: http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildRequires: glibc-devel +Requires(post): /bin/sh +Requires(preun): /bin/sh +Requires(post): perl +Requires(preun): perl +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +Requires: avahi + +%description +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 DNS +(aka Zeroconf, aka Apple Rendezvous, aka Apple Bonjour), effectively allowing +name resolution by common Unix/Linux programs in the ad-hoc mDNS domain .local. + +nss-mdns provides client functionality only, which means that you have to +run a mDNS responder daemon separately from nss-mdns if you want to register +the local host name via mDNS (e.g. Avahi). + +%prep +%setup -q + +%build +%configure --libdir=/%{_lib} --enable-avahi=yes --enable-legacy=no +make %{?_smp_mflags} + +%install +rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +/sbin/ldconfig +# Perl-fu to add mdns4_minimal to the hosts line of /etc/nsswitch.conf +if [ -f /etc/nsswitch.conf ] ; then + perl -ibak -pe ' + sub insert { + my @bits = split(" ", shift); + + if (grep { $_ eq "mdns4_minimal" || $_ eq "mdns4" + || $_ eq "mdns6_minimal" || $_ eq "mdns6" + || $_ eq "mdns_minimal" || $_ eq "mdns" } @bits) { + return join " ", @bits; + } + + return join " ", map { + $_ eq "dns" ? ("mdns4_minimal", "[NOTFOUND=return]", $_) : $_ + } @bits; + } + + s/^(hosts:\s+)(.*)$/$1.insert($2)/e; + ' /etc/nsswitch.conf +fi + +%preun +# Perl-fu to remove mdns4_minimal from the hosts line of /etc/nsswitch.conf +if [ "$1" -eq 0 -a -f /etc/nsswitch.conf ] ; then + perl -ibak -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:\s+)(.*)$/$1.remove($2)/e; + ' /etc/nsswitch.conf +fi + +%postun -p /sbin/ldconfig + +%files +%defattr(-, root, root) +%doc README +/%{_lib}/* + +%changelog +* Fri Jun 22 2007 - Lennart Poettering - 0.10-2 +- Fix up post/preun/postun dependencies, add "avahi" to the dependencies, + include dist tag in Release field, use _lib directory instead of literal /lib. + +* Fri Jun 22 2007 - Lennart Poettering - 0.10-1 +- Update to 0.10, replace perl script by simpler and more robust versions, + stolen from the Debian package + +* Thu Jul 13 2006 - Bastien Nocera - 0.8-2 +- Make use of Ezio's perl scripts to enable and disable mdns4 lookups + automatically, patch from Pancrazio `Ezio' de Mauro + +* Tue May 02 2006 - Bastien Nocera - 0.8-1 +- Update to 0.8, disable legacy lookups so that all lookups are made through + the Avahi daemon + +* Mon Apr 24 2006 - Bastien Nocera - 0.7-2 +- Fix building on 64-bit platforms + +* Tue Dec 13 2005 - Bastien Nocera - 0.7-1 +- Update to 0.7, fix some rpmlint errors + +* Thu Nov 10 2005 - Bastien Nocera - 0.6-1 +- Update to 0.6 + +* Tue Dec 07 2004 - Bastien Nocera 0.1-1 +- Initial package, automatically adds and remove mdns4 as a hosts service + diff --git a/sources b/sources index e69de29..e3d8ea5 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +03938f17646efbb50aa70ba5f99f51d7 nss-mdns-0.10.tar.gz