1Summary: NSD is a complete implementation of an authoritative DNS name server
2Name: nsd
3Version: 4.1.6
4Release: 1%{?dist}
5License: BSD
6Url: http://www.nlnetlabs.nl/%{name}/
7#Source: http://www.nlnetlabs.nl/downloads/%{name}/%{name}-%{version}.tar.gz
8Source: %{name}-%{version}.tar.gz
9Source1: nsd.init
10Source2: nsd.cron
11Group: System Environment/Daemons
12BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
13BuildRequires: flex, openssl-devel
14Requires(pre): shadow-utils
15
16%description
17NSD is a complete implementation of an authoritative DNS name server.
18It can function as a primary or secondary DNS server, with DNSSEC support.
19For further information about what NSD is and what NSD is not please
20consult the REQUIREMENTS document which is a part of this distribution.
21(thanks to Olaf).
22
23%prep
24%setup -q -n %{name}-%{version}
25
26%build
27%configure --enable-pie --enable-relro-now --enable-ratelimit \
28           --enable-bind8-stats --enable-plugins --enable-checking \
29           --enable-mmap --with-ssl --enable-nsec3 --enable-nsid \
30           --with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid --with-ssl \
31           --with-user=nsd --with-xfrdfile=%{_localstatedir}/lib/%{name}/ixfr.state
32
33%{__make} %{?_smp_mflags}
34#convert to utf8
35iconv -f iso8859-1 -t utf-8 doc/RELNOTES > doc/RELNOTES.utf8
36iconv -f iso8859-1 -t utf-8 doc/CREDITS > doc/CREDITS.utf8
37mv -f doc/RELNOTES.utf8 doc/RELNOTES
38mv -f doc/CREDITS.utf8 doc/CREDITS
39
40
41%install
42rm -rf %{buildroot}
43%{__make} DESTDIR=%{buildroot} install
44install -d -m 0755 %{buildroot}%{_initrddir}
45install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly
46install -c -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/nsd
47install -m 0755 %{SOURCE1} %{buildroot}/%{_initrddir}/nsd
48install -d -m 0700 %{buildroot}%{_localstatedir}/run/%{name}
49install -d -m 0700 %{buildroot}%{_localstatedir}/lib/%{name}
50
51# change .sample to normal config files
52head -76 %{buildroot}%{_sysconfdir}/nsd/nsd.conf.sample > %{buildroot}%{_sysconfdir}/nsd/nsd.conf
53rm %{buildroot}%{_sysconfdir}/nsd/nsd.conf.sample
54echo "database: /var/lib/nsd/nsd.db" >> %{buildroot}%{_sysconfdir}/nsd/nsd.conf
55echo "# include: \"/some/path/file\"" >> %{buildroot}%{_sysconfdir}/nsd/nsd.conf
56
57%clean
58rm -rf ${RPM_BUILD_ROOT}
59
60%files
61%defattr(-,root,root,-)
62%doc doc/*
63%doc contrib/nsd.zones2nsd.conf
64%dir %{_sysconfdir}/nsd/
65%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.conf
66#%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.zones
67%attr(0755,root,root) %{_initrddir}/%{name}
68%{_sysconfdir}/cron.hourly/nsd
69%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}
70%attr(0755,%{name},%{name}) %dir %{_localstatedir}/lib/%{name}
71%{_sbindir}/*
72%{_mandir}/*/*
73
74%pre
75getent group nsd >/dev/null || groupadd -r nsd
76getent passwd nsd >/dev/null || \
77useradd -r -g nsd -d /etc/nsd -s /sbin/nologin \
78-c "nsd daemon account" nsd
79exit 0
80
81%post
82/sbin/chkconfig --add %{name}
83
84%preun
85if [ $1 -eq 0 ]; then
86        /sbin/service %{name} stop
87        /sbin/chkconfig --del %{name}
88fi
89
90%postun
91if [ "$1" -ge "1" ]; then
92  /sbin/service %{name} condrestart
93fi
94