SHA256
1
0
forked from pool/nsd
nsd/nsd.spec

176 lines
4.9 KiB
RPMSpec
Raw Normal View History

#
# spec file for package nsd
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%if 0%{?suse_version} >= 1230
%bcond_without systemd
%define _rundir /run
%else
%bcond_with systemd
%define _rundir /var/run
%endif
# only needed for < 1310
%{!?_tmpfilesdir:%global _tmpfilesdir /usr/lib/tmpfiles.d}
Name: nsd
Version: 4.1.10
Release: 0
#
License: BSD-3-Clause
Group: Productivity/Networking/DNS/Servers
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libevent-devel
BuildRequires: openssl-devel
BuildRequires: pkgconfig
BuildRequires: pwdutils
BuildRequires: tcpd-devel
%if %{with systemd}
BuildRequires: systemd-devel
%{?systemd_requires}
%endif
PreReq: %insserv_prereq %fillup_prereq pwdutils
#
%define home %{_var}/lib/%{name}
%define configdir %{_sysconfdir}/%{name}
%define configfile %{configdir}/nsdc.conf
%define zonesfile %{configdir}/nsd.zones
%define zonesdir %{configdir}/
%define dbfile %{zonesdir}/nsd.db
%define pidfile %{_rundir}/nsd/nsd.pid
#
Url: http://open.nlnetlabs.nl/nsd/
Source: http://open.nlnetlabs.nl/downloads/nsd/nsd-%{version}.tar.gz
Source5: https://www.nlnetlabs.nl/downloads/nsd/nsd-%{version}.tar.gz.asc
Source4: nsd.keyring
Source1: nsd.service
Source2: tmpfiles-nsd.conf
Source3: nsd.init
#
Summary: An authoritative only, high performance domain name server
%description
NSD is a complete implementation of an authoritative domain name server developed
by NLnet Labs with the purpose of creating more diversity in the DNS landscape.
%prep
%setup
%build
export CFLAGS="${RPM_OPT_FLAGS} ${CFLAGS} -fPIE -Wformat-nonliteral -Wformat-security"
export LDFLAGS="${LDFLAGS} -pie -Wl,-z,relro,-z,now"
%configure \
--with-configdir=%{configdir} \
--with-zonesdir=%{configdir} \
--with-dbfile=%{home}/nsd.db \
--with-xfrdfile=%{home}/xfrd.state \
--with-pidfile=%{pidfile} \
--with-logfile=/var/log/nsd.log \
--enable-root-server \
--enable-bind8-stats \
--enable-zone-stats \
--enable-mmap \
--with-user=%{name} \
--enable-ratelimit
make %{?_smp_mflags}
iconv -f iso8859-1 -t utf-8 doc/RELNOTES > doc/RELNOTES.utf8
iconv -f iso8859-1 -t utf-8 doc/CREDITS > doc/CREDITS.utf8
mv -f doc/RELNOTES.utf8 doc/RELNOTES
mv -f doc/CREDITS.utf8 doc/CREDITS
%install
make install DESTDIR="%{buildroot}"
for i in %{buildroot}%{configdir}/*.sample ; do
cp -v $i ${i%%.sample}
done
chmod -Rv o= %{buildroot}%{configdir}/
#
install -d -m 0700 %{buildroot}%{home} \
%{buildroot}%{_rundir}/%{name}
#
install -d -m 0755 %{buildroot}/var/log/
touch %{buildroot}%{home}/{nsd.db,ixfr.db,xfrd.state} %{buildroot}/var/log/nsd.log
%if %{with systemd}
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/nsd.service
install -D -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/nsd.conf
ln -s -f /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
%else
install -D -m 0755 %{S:3} %{buildroot}%{_sysconfdir}/init.d/%{name}
ln -s -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
%endif
%pre
#
# e.g. adding user
#
%{_sbindir}/groupadd -r %{name} &>/dev/null ||:
%{_sbindir}/useradd -g %{name} -s /bin/false -r -c "user for %{name}" -d %{home} %{name} &>/dev/null ||:
%if %{with systemd}
%service_add_pre %{name}.service
%endif
%post
%fillup_only %{name}
%if %{with systemd}
systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf || :
%service_add_post %{name}.service
%endif
%preun
%if %{with systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal %{name}
%endif
%postun
%if %{with systemd}
%service_del_postun %{name}.service
%else
%restart_on_update %{name}
%{insserv_cleanup}
%endif
%files
%defattr(-,root,root)
%doc doc/*
%doc contrib/
%if %{with systemd}
%{_unitdir}/nsd.service
%{_tmpfilesdir}/nsd.conf
%else
%{_sysconfdir}/init.d/%{name}
%dir %attr(0700,%{name},%{name}) %{_rundir}/%{name}/
%endif
%{_sbindir}/rcnsd
%{_sbindir}/nsd
%{_sbindir}/nsd-control
%{_sbindir}/nsd-control-setup
%{_sbindir}/nsd-checkconf
%{_sbindir}/nsd-checkzone
%{_mandir}/man5/nsd.conf.5*
%{_mandir}/man8/nsd-checkconf.8*
%{_mandir}/man8/nsd-checkzone.8*
%{_mandir}/man8/nsd.8*
%{_mandir}/man8/nsd-control.8*
#
%config(noreplace) %attr(-,root,%{name}) %{configdir}
#
%dir %attr(750,%{name},%{name}) %{home}
%ghost %config %attr(640,%{name},%{name}) %{home}/nsd.db
%ghost %config %attr(640,%{name},%{name}) %{home}/ixfr.db
%ghost %config %attr(640,%{name},%{name}) %{home}/xfrd.state
#
%ghost %attr(640,%{name},%{name}) /var/log/nsd.log
#
%changelog