Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > c4ef4af3a4c99c3203d09046f5c29fac > files > 2

nss_mdns-0.7-4mdv2007.0.src.rpm

%define real_name nss-mdns 
%define release 4

Summary:    Multicast dns support for glibc domain resolver  
Name:       nss_mdns
Version:    0.7
Release:    %mkrel %release
Source: 	http://0pointer.de/lennart/projects/%real_name/%real_name-%version.tar.bz2
Group:		System/Libraries
License:	GPL
BuildRequires: libavahi-core-devel 
Buildroot:	%{_tmppath}/%{name}-%{version}-buildroot
Url:		http://0pointer.de/lennart/projects/%real_name/
%description
nss-mdns is a plugin for the Name Service Switch (NSS) functionality of the 
glibc providing host name resolution via Multicast DNS (aka Zeroconf, aka 
Apple Rendezvous), 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.

%prep
%setup -q -n %real_name-%version

%build
%configure2_5x --libdir=/%_lib --enable-avahi
%make

%install
rm -rf %{buildroot}
%makeinstall
mv $RPM_BUILD_ROOT/%_libdir/ $RPM_BUILD_ROOT/%_lib/

mkdir -p $RPM_BUILD_ROOT/%_sysconfdir/
cat > $RPM_BUILD_ROOT/%_sysconfdir/mdns.allow  <<EOF
# place here the domain that should be resolved by multicast dns
# use * to include all ( not recommended )
.local.
.local
EOF


%files
%defattr(-,root,root,755)
%doc README doc/README.html doc/style.css
/%_lib/*
%config(noreplace) %_sysconfdir/mdns.allow

%post 
/sbin/ldconfig

if [ $1 = 1 ]; then
   # ipv4 by default, as explained on the webpage
    source /etc/sysconfig/network
    if [ "${NETWORKING_IPV6}" = "yes" ]; then 
        # for both ipv6 and ipv4
        perl -pi -e '!/mdns/ && s/^(hosts:\s*)(.*)$/$1 mdns $2/' /etc/nsswitch.conf
    else
        perl -pi -e '!/mdns/ && s/^(hosts:\s*)(.*)$/$1 mdns4 $2/' /etc/nsswitch.conf
    fi
fi

%postun 
/sbin/ldconfig
if [ $1 = 0 ]; then
    perl -pi -e 's/^(hosts:.*)\smdns\d?(\s.*)$/$1 $2/' /etc/nsswitch.conf
fi

%clean
rm -rf %{buildroot}

%changelog
* Wed Aug 09 2006 Michael Scherer <misc@mandriva.org> 0.7-4mdv2007.0
- Rebuild to have src in sync with binary
- adapt to the new rpmbuildupdate parser of spec

* Tue Feb 07 2006 Michael Scherer <misc@mandriva.org> 0.7-3mdk
- remove avahi requires, works fine if the daemon is not running

* Fri Jan 20 2006 Michael Scherer <misc@mandriva.org> 0.7-2mdk
- build with avahi support
- requires avahi ( fix bug #20002 )

* Fri Nov 25 2005 Michael Scherer <misc@mandriva.org> 0.7-1mdk
- New release 0.7

* Sat Nov 05 2005 Michael Scherer <misc@mandriva.org> 0.6-3mdk
- really fix upgrade and uninstall
 ( last update removed mdns, should be renabled by hand for thos that used -2mdk )

* Fri Nov 04 2005 Michael Scherer <misc@mandriva.org> 0.6-2mdk
- place it first, as it has no impact on resolution except for .local, and
  speed mdns resolution
- fix post upgrade

* Tue Aug 30 2005 Michael Scherer <misc@mandriva.org> 0.6-1mdk
- first package