1Summary: Validating, recursive, and caching DNS resolver
2Name: unbound
3Version: 1.4.18
4Release: 1%{?dist}
5License: BSD
6Url: http://www.nlnetlabs.nl/unbound/
7Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
8#Source1: unbound.init
9Group: System Environment/Daemons
10Requires: ldns
11BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
12BuildRequires: flex, openssl-devel, expat-devel, ldns-devel
13
14%description
15Unbound is a validating, recursive, and caching DNS resolver.
16
17The C implementation of Unbound is developed and maintained by NLnet
18Labs. It is based on ideas and algorithms taken from a java prototype
19developed by Verisign labs, Nominet, Kirei and ep.net.
20
21Unbound is designed as a set of modular components, so that also
22DNSSEC (secure DNS) validation and stub-resolvers (that do not run
23as a server, but are linked into an application) are easily possible.
24
25The source code is under a BSD License.
26
27%prep
28%setup -q
29
30# configure with /var/unbound/unbound.conf so that all default chroot, 
31# pidfile and config file are in /var/unbound, ready for chroot jail set up.
32%configure --with-conf-file=%{_localstatedir}/%{name}/unbound.conf --disable-rpath
33
34%build
35#%{__make} %{?_smp_mflags}
36make
37
38%install
39rm -rf %{buildroot}
40%{__make} DESTDIR=%{buildroot} install
41install -d 0700 %{buildroot}%{_localstatedir}/%{name}
42install -d 0755 %{buildroot}%{_initrddir}
43install -m 0755 contrib/unbound.init %{buildroot}%{_initrddir}/unbound
44# add symbolic link from /etc/unbound.conf -> /var/unbound/unbound.conf
45ln -s %{_localstatedir}/unbound/unbound.conf %{buildroot}%{_sysconfdir}/unbound.conf 
46# remove static library from install (fedora packaging guidelines)
47rm -f %{buildroot}%{_libdir}/libunbound.a %{buildroot}%{_libdir}/libunbound.la
48
49%clean
50rm -rf ${RPM_BUILD_ROOT}
51
52%files
53%defattr(-,root,root,-)
54%doc doc/README doc/CREDITS doc/LICENSE doc/FEATURES
55%attr(0755,root,root) %{_initrddir}/%{name}
56%attr(0700,%{name},%{name}) %dir %{_localstatedir}/%{name}
57%attr(0644,%{name},%{name}) %config(noreplace) %{_localstatedir}/%{name}/unbound.conf
58%attr(0644,%{name},%{name}) %config(noreplace) %{_sysconfdir}/unbound.conf
59%{_sbindir}/*
60%{_mandir}/*/*
61%{_includedir}/*
62%{_libdir}/libunbound*
63
64%pre
65getent group unbound >/dev/null || groupadd -r unbound
66getent passwd unbound >/dev/null || \
67useradd -r -g unbound -d /var/unbound -s /sbin/nologin \
68    -c "unbound name daemon" unbound
69exit 0
70
71%post
72# This adds the proper /etc/rc*.d links for the script
73/sbin/chkconfig --add %{name}
74
75%preun
76if [ $1 -eq 0 ]; then
77	/sbin/service %{name} stop >/dev/null 2>&1
78	/sbin/chkconfig --del %{name}
79	# remove root jail 
80	rm -f /var/unbound/dev/log /var/unbound/dev/random /var/unbound/etc/localtime /var/unbound/etc/resolv.conf >/dev/null 2>&1
81	rmdir /var/unbound/dev >/dev/null 2>&1 || :
82	rmdir /var/unbound/etc >/dev/null 2>&1 || :
83	rmdir /var/unbound >/dev/null 2>&1 || :
84fi
85
86%postun
87if [ "$1" -ge "1" ]; then
88	/sbin/service %{name} condrestart >/dev/null 2>&1 || :
89fi
90
91%changelog
92* Thu Jul 13 2011 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.4.8
93- ldns required and ldns-devel required for build, no more ldns-builtin.
94
95* Thu Mar 17 2011 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.4.8
96- removed --disable-gost, assume recent openssl on the destination platform.
97
98* Wed Mar 16 2011 Harold Jones <hajones@verisign.com> - 1.4.8
99- Bump version number to latest
100- Add expat-devel to BuildRequires
101- Added --disable-gost for building on CentOS 5.x
102- Added --with-ldns-builtin for CentOS 5.x
103
104* Thu May 22 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.0.0
105- contrib changes from Patrick Vande Walle.
106
107* Thu Apr 25 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 0.12
108- Using parts from ports collection entry by Jaap Akkerhuis.
109- Using Fedoraproject wiki guidelines.
110
111* Wed Apr 23 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 0.11
112- Initial version.
113