nss-mdns/nss-mdns.spec

124 lines
4.0 KiB
RPMSpec
Raw Normal View History

#
# 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: 8
Group: Productivity/Networking/DNS/Utilities
License: GNU Library General Public License v. 2.0 and 2.1 (LGPL)
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
%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 seperately from nss-mdns if you want to
register the local host name via mDNS. I recommend Avahi.
By default nss-mdns tries to contact a running avahi-daemon for
resolving host names and addresses and making 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
# If none currently supported module is configured, add the default configuration.
if ! grep -q "[[:space:]]\\(mdns\\|mdns4\\|mdns4_minimal\\|mdns_minimal\\|mdns6\\|mdns6_minimal\\)\\([[:space:]]\\|$\\)" etc/nsswitch.conf ; then
# If "dns" is present (most probably), add the proposed line. Otherwise add it to the end of the list.
sed -i "/^hosts:/{
s/\\([[:space:]]\\)dns\\([[:space:]]\\|\$\\)/\\1mdns_minimal [NOTFOUND=return] dns mdns\\2/;
t1;
s/\$/ mdns_minimal [NOTFOUND=return] mdns/;
:1;
}" etc/nsswitch.conf
fi
%posttrans
# We repeat exactly the same as in %%post to catch situation, when only discontinued modules were present before upgrade.
# If none currently supported module is configured, add the default configuration.
if ! grep -q "[[:space:]]\\(mdns\\|mdns4\\|mdns4_minimal\\|mdns_minimal\\|mdns6\\|mdns6_minimal\\)\\([[:space:]]\\|$\\)" etc/nsswitch.conf ; then
# If "dns" is present (most probably), add the proposed line. Otherwise add it to the end of the list.
sed -i "/^hosts:/{
s/\\([[:space:]]\\)dns\\([[:space:]]\\|\$\\)/\\1mdns_minimal [NOTFOUND=return] dns mdns\\2/;
t1;
s/\$/ mdns_minimal [NOTFOUND=return] mdns/;
:1;
}" 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
* Sat Apr 21 2007 - schwab@suse.de
- Fix unaligned access.
* Tue Feb 20 2007 - sbrabec@suse.cz
- New SuSE package, version 0.9.