nss-mdns/nss-mdns.spec

162 lines
4.5 KiB
RPMSpec

#
# spec file for package nss-mdns (Version 0.9)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: nss-mdns
# lynx is not needed, text version of README is already present
#BuildRequires: lynx
Version: 0.9
Release: 38
Group: Productivity/Networking/DNS/Utilities
License: LGPL v2 or later
URL: http://0pointer.de/lennart/projects/nss-mdns/
Summary: Host Name Resolution Via Multicast DNS (Zeroconf) for glibc
Source: %{name}-%{version}.tar.bz2
Patch: unaligned.diff
AutoReqProv: on
PreReq: sed grep
Requires: avahi
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%ifarch x86_64 s390x
Requires: %{name}-32bit = %{version}
%endif
%ifarch ppc
Requires: %{name}-64bit = %{version}
%endif
%description
nss-mdns is a plug-in for the GNU Name Service Switch (NSS)
functionality of the GNU C Library (glibc) providing a hostname
resolution via Multicast DNS (aka Zeroconf, aka Apple Rendezvous, aka
Apple Bonjour), and effectively allowing name resolution by common
Unix/Linux programs in the ad-hoc mDNS domain .local.
nss-mdns provides only client functionality, which means that you have
to run a mDNS responder daemon seperately from nss-mdns if you want to
register the local hostname via mDNS. I recommend Avahi.
By default, nss-mdns tries to contact a running avahi-daemon to resolve
hostnames and addresses and makes use of its superior record cacheing.
Authors:
--------
Lennart Poettering <mzaffzqaf@0pointer.de>
%prep
%setup -q
%patch
%build
%configure --libdir=/%{_lib}
%install
%makeinstall
%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
/sbin/ldconfig
# Build a regexp removing all no more provided libraries.
# If there are no known libraries installed, remove also related "[NOTFOUND=return]"
REMOVE_REGEXP=
REAL_REMOVE=true
for NSS_NAME in mdns mdns4 mdns4_minimal mdns_minimal mdns6 mdns6_minimal ; do
if test -f %{_lib}/libnss_$NSS_NAME.so.2 ; then
REAL_REMOVE=false
else
REMOVE_REGEXP="${REMOVE_REGEXP}
s/\\([[:space:]][[:space:]]*\\)$NSS_NAME\\([[:space:]][[:space:]]*\\)/\\1/g;
s/\\([[:space:]][[:space:]]*\\)$NSS_NAME\$//g;"
fi
done
if $REAL_REMOVE ; then
REMOVE_REGEXP="s/\\(mdns[46]*_minimal\\)[[:space:]][[:space:]]*\\[NOTFOUND=return\\]/\\1/;$REMOVE_REGEXP"
fi
sed -i "/^hosts:/{$REMOVE_REGEXP}" etc/nsswitch.conf
%files
%defattr(-,root,root)
%doc LICENSE README doc/*.html doc/*.css
/%{_lib}/libnss_mdns.so.2
/%{_lib}/libnss_mdns4.so.2
/%{_lib}/libnss_mdns4_minimal.so.2
/%{_lib}/libnss_mdns6.so.2
/%{_lib}/libnss_mdns6_minimal.so.2
/%{_lib}/libnss_mdns_minimal.so.2
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Sep 11 2007 - ro@suse.de
- modify last change:
- require 32bit variant on x86_64 and s390x
- require 64bit variant on ppc
* Mon Sep 10 2007 - sbrabec@suse.cz
- Fixed invalid dependency for bi-arch (#309193).
* Thu Sep 06 2007 - mauro@suse.de
- Sync the spec with the scripts in the comment #6 of bnc #287583
* Thu Sep 06 2007 - mauro@suse.de
- The 64 bit version of nss-mdns will require the -32 version to
bugfix bnc #287583.
* Sat Apr 21 2007 - schwab@suse.de
- Fix unaligned access.
* Tue Feb 20 2007 - sbrabec@suse.cz
- New SuSE package, version 0.9.