File knot.spec of Package knot
#
# spec file for package knot
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: knot
Url: http://www.knot-dns.cz
Version: 1.3.1
Release: 0
Summary: An authoritative DNS daemon
License: GPL-3.0+
Group: Productivity/Networking/DNS/Servers
Requires(pre): pwdutils
BuildRequires: bison
BuildRequires: flex
BuildRequires: liburcu-devel
# We really only need makeinfo
%if 0%{?suse_version} > 1220
BuildRequires: makeinfo
%else
BuildRequires: texinfo
%endif
BuildRequires: openssl-devel
%if 0%{?suse_version} > 1140
BuildRequires: systemd
%{?systemd_requires}
%define has_systemd 1
%endif
Source0: http://public.nic.cz/files/knot-dns/%{name}-%{version}.tar.bz2
Source1: knot.conf
Source2: knot.service
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Knot DNS is a high-performance authoritative DNS server implementation.
%prep
%setup -q
%build
%if 0%{suse_version} == 1210
export SUSE_ASNEEDED=0
%endif
%configure \
--sysconfdir=%{_sysconfdir}/%{name} \
--libexecdir=%{_libexecdir}/%{name} \
--localstatedir=/var/lib \
--libexecdir=%{_libexecdir}/%{name}
make %{?_smp_mflags}
%install
make DESTDIR=%{buildroot} install
rm %{buildroot}/%{_infodir}/dir
install -d %{buildroot}%{_docdir}/%{name}
install -d %{buildroot}%{_docdir}/%{name}/samples/
rm -r %{buildroot}%{_sysconfdir}/%{name}/%{name}
install -p -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
%if 0%{?has_systemd}
install -d %{buildroot}%{_unitdir}
install -p -m644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
%endif
install -p -m644 COPYING AUTHORS NEWS THANKS README %{buildroot}%{_docdir}/%{name}
install -p -m644 samples/*.conf samples/*.zone* %{buildroot}%{_docdir}/%{name}/samples/
%pre
getent group knot >/dev/null || groupadd -r knot
getent passwd knot >/dev/null || \
useradd -r -g knot -d %{_sysconfdir}/knot -s /sbin/nologin \
-c "Knot DNS server" knot
%if 0%{?has_systemd}
%service_add_pre %{name}.service
%endif
%preun
%if 0%{?has_systemd}
%service_del_preun %{name}.service
%endif
%post
%if 0%{?has_systemd}
%service_add_post %{name}.service
%endif
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}
%postun
%if 0%{?has_systemd}
%service_del_postun %{name}.service
%endif
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}
%files
%defattr(-,root,root)
%dir %attr(750,root,root) %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%{_sbindir}/*
%{_bindir}/*
%{_mandir}/man?/*
%doc %{_docdir}/%{name}
%doc %{_infodir}/*
%if 0%{?has_systemd}
%{_unitdir}/%{name}.service
%endif
%changelog