Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > bd8fe0ac4c576e2c1ce87c63c41c27dc > files > 2

nss_mdns-0.15.1-2.mga9.src.rpm

%define real_name nss-mdns

%define major	2
%define libname	%mklibname %{real_name} %{major}

Summary:	Multicast dns support for glibc domain resolver
Name:		nss_mdns
Version:	0.15.1
Release:	%mkrel 2
License:	LGPLv2+
Url:		https://github.com/lathiat/nss-mdns
Source:		https://github.com/lathiat/nss-mdns/releases/download/v%{version}/%{real_name}-%{version}.tar.gz
Group:		System/Libraries
BuildRequires:	pkgconfig(avahi-core)

%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.

%package data
Summary:	Configuration files for %{name}
Group:		Networking/Other
BuildArch:	noarch
Conflicts:	%{name} < 0.10-11

%description data
This package contains the configuration files for %{name}.

%package -n %{libname}
Summary:	Multicast dns support for glibc domain resolver
Group:		System/Libraries
Obsoletes:	%{name} < 0.10-11
Provides:	%{name} = %{version}-%{release}
Provides:	%{name}-modules = %{version}-%{release}
Requires:	%{name}-data >= %{version}
# for /etc/sysconfig/network
Requires(post):	initscripts

%description -n %{libname}
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
# to recognize aarch64
autoreconf -vfi

%configure \
	--enable-avahi
%make_build

%install
%make_install

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

%post -n %{libname}
if [ $1 = 1 ]; then
   # ipv4 by default, as explained on the webpage
    [ -f /etc/sysconfig/network ] && source /etc/sysconfig/network
    unset hosts
    eval $(grep ^hosts: /etc/nsswitch.conf|sed -e 's/hosts:\(.*\)$/hosts=\"\1\"/')
    if [ "${NETWORKING_IPV6}" = "yes" ]; then
        # for both ipv6 and ipv4
	minimal_nss=mdns_minimal
	dns_nss=mdns
    else
        minimal_nss=mdns4_minimal
	dns_nss=mdns4
    fi
    new_hosts=$minimal_nss

    for i in $hosts; do
        if [ $i != mdns4_minimal ] && [ $i != mdns_minimal ] && [ $i != mdns4 ] && [ $i != mdns ]; then
            if [ -n "$new_hosts" ]; then
                new_hosts="$new_hosts $i"
            else
                new_hosts="$i"
            fi
            if [ $i = dns ] && [ -n "$dns_nss" ]; then
                new_hosts="$new_hosts $dns_nss"
            fi
        fi
    done
    sed -i -e "s/^hosts:.*$/hosts:\t\t$new_hosts/" /etc/nsswitch.conf
fi

%postun -n %{libname}
if [ $1 = 0 ]; then
    unset hosts
    eval $(grep ^hosts: /etc/nsswitch.conf|sed -e 's/hosts:\(.*\)$/hosts=\"\1\"/')

    for i in $hosts; do
        if [ $i != mdns4_minimal ] && [ $i != mdns_minimal ] && [ $i != mdns4 ] && [ $i != mdns ]; then
            if [ -n "$new_hosts" ]; then
                new_hosts="$new_hosts $i"
            else
                new_hosts="$i"
            fi
            if [ $i = dns ] && [ -n "$dns_nss" ]; then
                new_hosts="$new_hosts $dns_nss"
            fi
        fi
    done
    sed -i -e "s/^hosts:.*$/hosts:\t\t$new_hosts/" /etc/nsswitch.conf
fi

%files data
%config(noreplace) %{_sysconfdir}/mdns.allow

%files -n %{libname}
%doc README.md NEWS.md
%{_libdir}/lib%{name}*.so.%{major}


%changelog
* Wed Apr 06 2022 umeabot <umeabot> 0.15.1-2.mga9
+ Revision: 1845720
- Mageia 9 Mass Rebuild

* Sun Aug 08 2021 luigiwalser <luigiwalser> 0.15.1-1.mga9
+ Revision: 1740249
- 0.15.1
- update URLs

* Thu Feb 13 2020 umeabot <umeabot> 0.10-19.mga8
+ Revision: 1515563
- Mageia 8 Mass Rebuild
+ wally <wally>
- replace deprecated %%configure2_5x

* Sun Sep 23 2018 umeabot <umeabot> 0.10-18.mga7
+ Revision: 1299802
- Mageia 7 Mass Rebuild

* Thu Jun 21 2018 pterjan <pterjan> 0.10-17.mga7
+ Revision: 1238649
- Rebuild for aarch64 fix
+ wally <wally>
- fix URLs
+ kekepower <kekepower>
- Use new make macros

* Mon Feb 08 2016 umeabot <umeabot> 0.10-16.mga6
+ Revision: 950623
- Mageia 6 Mass Rebuild

* Thu Nov 13 2014 cjw <cjw> 0.10-15.mga5
+ Revision: 796717
- fix post and postun scripts; default config is now always set on install
- remove non-working URLs

* Wed Oct 15 2014 umeabot <umeabot> 0.10-14.mga5
+ Revision: 744534
- Second Mageia 5 Mass Rebuild

* Tue Sep 16 2014 umeabot <umeabot> 0.10-13.mga5
+ Revision: 682942
- Mageia 5 Mass Rebuild

* Sat Oct 19 2013 umeabot <umeabot> 0.10-12.mga4
+ Revision: 528203
- Mageia 4 Mass Rebuild

* Sun Jun 16 2013 wally <wally> 0.10-11.mga4
+ Revision: 443769
- libify pkg

* Sat Jan 12 2013 umeabot <umeabot> 0.10-10.mga3
+ Revision: 361066
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Sat Jan 15 2011 pterjan <pterjan> 0.10-9.mga1
+ Revision: 18945
- Drop obsolete scriptlets
- imported package nss_mdns


* Fri Dec 03 2010 Oden Eriksson <oeriksson@mandriva.com> 0.10-9mdv2011.0
+ Revision: 606829
- rebuild

* Mon Mar 15 2010 Oden Eriksson <oeriksson@mandriva.com> 0.10-8mdv2010.1
+ Revision: 520195
- rebuilt for 2010.1

* Thu Sep 03 2009 Christophe Fergeau <cfergeau@mandriva.com> 0.10-7mdv2010.0
+ Revision: 426258
- rebuild
- use %%configure2_5x instead of %%configure (to avoid calling libtoolize)

* Thu Dec 25 2008 Adam Williamson <awilliamson@mandriva.org> 0.10-6mdv2009.1
+ Revision: 318784
- rebuild for new avahi-core major

* Wed Jul 30 2008 Michael Scherer <misc@mandriva.org> 0.10-5mdv2009.0
+ Revision: 254778
- fix bug 33612, thanks to eric piel for the fix
- remove trailling whitespace in spec

* Tue Jun 17 2008 Thierry Vignaud <tv@mandriva.org> 0.10-4mdv2009.0
+ Revision: 223352
- rebuild

  + Pixel <pixel@mandriva.com>
    - do not call ldconfig in %%post/%%postun, it is now handled by filetriggers

  + Michael Scherer <misc@mandriva.org>
    - check that /etc/sysconfig/network existe before source it, reported by muny/yvan
      on irc

* Tue Mar 25 2008 Olivier Blin <oblin@mandriva.com> 0.10-3mdv2008.1
+ Revision: 189917
- require initscripts in post script so that /etc/sysconfig/network is available

* Tue Mar 04 2008 Oden Eriksson <oeriksson@mandriva.com> 0.10-2mdv2008.1
+ Revision: 179098
- rebuild

  + Olivier Blin <oblin@mandriva.com>
    - restore BuildRoot

  + Thierry Vignaud <tv@mandriva.org>
    - kill re-definition of %%buildroot on Pixel's request

* Tue May 22 2007 Tomasz Pawel Gajc <tpg@mandriva.org> 0.10-1mdv2008.0
+ Revision: 29702
- new upstream version

  + Michael Scherer <misc@mandriva.org>
    - fix uninstallation scriptlet
    - fix scriptlet to place mdns_minimal before and mdns at the end, related to bug #30340


* Thu Jan 04 2007 Michael Scherer <misc@mandriva.org> 0.9-1mdv2007.0
+ Revision: 104201
- update to 0.9
- Import nss_mdns