1Summary: Validating, recursive, and caching DNS resolver
2Name: unbound
3Version: 1.13.1
4Release: 1%{?dist}
5License: BSD
6Url: http://www.nlnetlabs.nl/unbound/
7Source: http://www.nlnetlabs.nl/downloads/unbound/%{name}-%{version}.tar.gz
8#Source1: unbound.init
9Group: System Environment/Daemons
10BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
11BuildRequires: flex, openssl-devel, expat-devel
12
13%description
14Unbound is a validating, recursive, and caching DNS resolver.
15
16The C implementation of Unbound is developed and maintained by NLnet
17Labs. It is based on ideas and algorithms taken from a java prototype
18developed by Verisign labs, Nominet, Kirei and ep.net.
19
20Unbound is designed as a set of modular components, so that also
21DNSSEC (secure DNS) validation and stub-resolvers (that do not run
22as a server, but are linked into an application) are easily possible.
23
24The source code is under a BSD License.
25
26%prep
27%setup -q
28
29# configure with /var/unbound/unbound.conf so that all default chroot,
30# pidfile and config file are in /var/unbound, ready for chroot jail set up.
31%configure --with-conf-file=%{_localstatedir}/%{name}/unbound.conf --disable-rpath
32
33%build
34#%{__make} %{?_smp_mflags}
35make
36
37%install
38rm -rf %{buildroot}
39%{__make} DESTDIR=%{buildroot} install
40install -d 0700 %{buildroot}%{_localstatedir}/%{name}
41install -d 0755 %{buildroot}%{_initrddir}
42install -m 0755 contrib/unbound.init %{buildroot}%{_initrddir}/unbound
43# add symbolic link from /etc/unbound.conf -> /var/unbound/unbound.conf
44ln -s ../%{_localstatedir}/unbound/unbound.conf %{buildroot}%{_sysconfdir}/unbound.conf
45# remove static library from install (fedora packaging guidelines)
46rm -f %{buildroot}%{_libdir}/libunbound.a %{buildroot}%{_libdir}/libunbound.la
47
48%clean
49rm -rf ${RPM_BUILD_ROOT}
50
51%files
52%defattr(-,root,root,-)
53%doc doc/README doc/CREDITS doc/LICENSE doc/FEATURES
54%attr(0755,root,root) %{_initrddir}/%{name}
55%attr(0700,%{name},%{name}) %dir %{_localstatedir}/%{name}
56%attr(0644,%{name},%{name}) %config(noreplace) %{_localstatedir}/%{name}/unbound.conf
57%config(noreplace) %{_sysconfdir}/unbound.conf
58%{_sbindir}/*
59%{_mandir}/*/*
60%{_includedir}/*
61%{_libdir}/libunbound*
62%{_libdir}/pkgconfig/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 Jun 10 2021 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.13.1
93- ldns and ldns-devel no longer required. Fixed date. Version to 1.13.1.
94- Removed symlink attr mode, made unbound.conf symlink relative.
95- Added pkgconfig/libunbound.pc to the packaged files.
96- fixed download url to nlnetlabs.nl download.
97
98* Wed Jul 13 2011 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.4.8
99- ldns required and ldns-devel required for build, no more ldns-builtin.
100
101* Thu Mar 17 2011 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.4.8
102- removed --disable-gost, assume recent openssl on the destination platform.
103
104* Wed Mar 16 2011 Harold Jones <hajones@verisign.com> - 1.4.8
105- Bump version number to latest
106- Add expat-devel to BuildRequires
107- Added --disable-gost for building on CentOS 5.x
108- Added --with-ldns-builtin for CentOS 5.x
109
110* Thu May 22 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.0.0
111- contrib changes from Patrick Vande Walle.
112
113* Thu Apr 25 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 0.12
114- Using parts from ports collection entry by Jaap Akkerhuis.
115- Using Fedoraproject wiki guidelines.
116
117* Wed Apr 23 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 0.11
118- Initial version.
119