Summary:		Modern, advanced and high performance recursing/non authoritative nameserver
Summary(ja):		Modern, advanced and high performance recursing/non authoritative nameserver
Name:			pdns-recursor
Version:		3.3
Release:                2%{?_dist_release}
Group:			System Environment/Daemons
License:		GPLv2
URL:			http://powerdns.com
Source0:		http://downloads.powerdns.com/releases/%{name}-%{version}.tar.bz2
Source1:		pdns-recursor.init	

Patch0:			pdns-recursor-fixmakefile.patch
Patch1:			pdns-recursor-fixsysconfdir.patch

Provides:		powerdns-recursor = %{version}-%{release}
BuildRequires:		libboost-devel, lua-devel
Requires(pre):          shadow-utils
Requires(post):		chkconfig
Requires(preun):	chkconfig, initscripts 

%description
PowerDNS Recursor is a non authoritative/recursing DNS server. Use this
package if you need a dns cache for your network.

%prep
%setup -q
%patch0 -p1 -b .fixmakefile
%patch1 -p1 -b .fixsysconfdir

%build
LUA=1 LUA_CPPFLAGS_CONFIG= LUA_LIBS_CONFIG=-llua OPTFLAGS="%{optflags}" make %{?_smp_mflags}


%install
%{__rm} -rf %{buildroot}
make install DESTDIR=%{buildroot} CONFIGDIR="%{_sysconfdir}/%{name}"
%{__install} -D -p %{SOURCE1} %{buildroot}%{_initrddir}/pdns-recursor

%{__mv} %{buildroot}%{_sysconfdir}/%{name}/recursor.conf{-dist,}

# add pdns user and group to top of configfile
sed -i '1i\setuid=pdns-recursor' %{buildroot}%{_sysconfdir}/%{name}/recursor.conf
sed -i '2i\setgid=pdns-recursor' %{buildroot}%{_sysconfdir}/%{name}/recursor.conf

%pre
getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor
getent passwd pdns-recursor > /dev/null || \
    useradd -r -g pdns-recursor -d / -s /sbin/nologin \
    -c "PwerDNS Recursor user" pdns-recursor
exit 0

%post
chkconfig --add %{name}

%preun
if [ $1 -eq 0 ]; then
    service %{name} stop >/dev/null 2>&1 || :
    chkconfig --del %{name}
fi

%postun
if [ $1 -ge 1 ]; then
    service %{name} condrestart >/dev/null 2>&1 || :
fi

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{_bindir}/rec_control
%{_sbindir}/pdns_recursor
%{_mandir}/man1/pdns_recursor.1.gz
%{_mandir}/man1/rec_control.1.gz
%{_initrddir}/pdns-recursor
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/recursor.conf
%doc COPYING README


%changelog
* Fri Sep 02 2016 Toshiaki Ara <ara_t@384.jp> 3.3-2
- rebuild with gcc-5.4.0

* Wed Apr 11 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 		3.3-1
- initial build for Vine Linux

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Sep 29 2010 jkeating - 3.3-2
- Rebuilt for gcc bug 634757

* Sat Sep 25 2010 Ruben Kerkhof <ruben@rubenkerkhof.com> 3.3-1
- Upstream released new version: http://doc.powerdns.com/changelog.html

* Thu May 13 2010 Ruben Kerkhof <ruben@rubenkerkhof.com> 3.2-2
- Correct group name (bz #591214)

* Sun Mar 14 2010 Ruben Kerkhof <ruben@rubenkerkhof.com> 3.2-1
- Upstream released new version
- Adjust scriptlets to packaging guidelines

* Mon Mar 01 2010 Ruben Kerkhof <ruben@rubenkerkhof.com> 3.2-0.1.rc2
- Upstream released new version

* Wed Jan 06 2010 Ruben Kerkhof <ruben@rubenkerkhof.com> 3.1.7.2-1
- Upstream released new version
- Fixes CVE-2009-4009 and CVE-2009-4010

* Tue Nov 24 2009 Ruben Kerkhof <ruben@rubenkerkhof.com> 3.1.7.1-3
- Start recursor earlier in the boot process (#540428)

* Mon Aug 10 2009 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.7.1-2
- Re-add accidently dropped patch (#516562)

* Mon Aug 03 2009 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.7.1-1
- Upstream released new version
- Drop patches included upstream

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.7-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri Feb 27 2009 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.7-4
- Fix errors with newer Boost
- Fix build with gcc4.4

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Thu Jul 24 2008 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.7-2
- Use OPTFLAGS because CXXFLAGS overrides the defaults

* Thu Jul 24 2008 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.7-1
- Upstream released new version, now with Lua support

* Sun May 11 2008 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.6
- Upstream released new version

* Wed Apr 02 2008 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.5
- Upstream released new version

* Sat Feb 16 2008 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.5-0.1.snapshot4
- Snapshot 4
- Drop gcc 4.3 patch, fixed upstream

* Sat Feb 09 2008 Ruben Kerkhof <ruben@rubenkerkhof.com> - 3.1.5-0.1.snapshot3
- Sync with upstream
- Compile fixes for gcc43

* Sun Jan 27 2007 <ruben@rubenkerkhof.com> 3.1.4-4
- Now really fix the description in init script
* Sat Jan 27 2007 <ruben@rubenkerkhof.com> 3.1.4-3
- Fixed Description in init script
* Wed Jan 24 2007 <ruben@rubenkerkhof.com> 3.1.4-2
- Fixes per bz review 221188:
- Changed user to pdns-recursor
- Patched the Makefile to not strip debugsymbols
- Skipped the configure step, it didn't do much
- Added a more Fedora-centric initscript
- Use condrestart instead of restart in %%postun
* Sun Dec 31 2006 <ruben@rubenkerkhof.com> 3.1.4-1
- Initial import

