LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File pdns-recursor.spec of Package pdns-recursor (Project server:dns)

# spec file for package pdns-recursor (Version
# Copyright (c) 2009 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/

# norootforbuild
%if 0%{?suse_version} > 1230
%bcond_without systemd
%bcond_with    systemd

Name:           pdns-recursor
Version:        3.7.3
Release:        1
%define pkg_version    %{version}
Group:          Productivity/Networking/DNS/Servers
License:        GPL-2.0+
%define home           %{_var}/lib/pdns
%if %{with systemd}
%define  _localstatedir /run/pdns
%define  _localstatedir /var/run/pdns
%define makeflags OPTFLAGS="%{optflags} -fpic -DPIC -fPIE" LUA=1 LUA_LIBS_CONFIG="-l%lua_lib -Wl,-z,relro,-z,now -pie" LUA_CPPFLAGS_CONFIG="-I/usr/include/lua5.1" STRIP_BINARIES=0 SYSCONFDIR="%{_sysconfdir}/pdns" LOCALSTATEDIR="%{_localstatedir}" BINDIR="%{_sbindir}"
BuildRequires:  boost-devel gcc-c++
%if 0%{?suse_version} && (0%{?suse_version} < 1030 || 0%{?suse_version} > 1210)
BuildRequires:  lua51-devel
%if 0%{?suse_version} > 1210
%define lua_lib lua
%define lua_lib lua5.1
BuildRequires:  lua-devel
%define lua_lib lua
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
PreReq:         %insserv_prereq %fillup_prereq
PreReq:         pwdutils
PreReq:         shadow-utils
%if %{with systemd}
BuildRequires:  pkgconfig(systemd)
%define has_systemd 1
Url:            http://www.powerdns.com/
Source:         http://downloads.powerdns.com/releases/%{name}-%{pkg_version}.tar.bz2
Source1:        pdns-recursor.init
Source2:        recursor.conf
Source3:        pdns-recursor.service
Source4:        pdns-recursor.tmpfiles.d
Summary:        Modern, advanced and high performance recursing/non authoritative nameserver
PowerDNS Recursor is a non authoritative/recursing DNS server. Use this
package if you need a dns cache for your network.


%setup -n %{name}-%{pkg_version}

make %{makeflags} all

make install DESTDIR="%{buildroot}" %{makeflags}
# config
%{__install} -D -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/pdns/recursor.conf
mkdir -p %{buildroot}%{_localstatedir}
# init systems
%if %{with systemd}
%{__install} -D -m 0644 %{S:3} %{buildroot}%{_unitdir}/%{name}.service
%{__install} -D -m 0644 %{S:4} %{buildroot}/usr/lib/tmpfiles.d/%{name}.conf
%{__ln_s} -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
# installed by make install
rm -rv %{buildroot}%{_sysconfdir}/init.d/%{name}
%{__install} -D  -m 0755 %{S:1} %{buildroot}%{_sysconfdir}/init.d/%{name}
%{__ln_s} -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
# homedir
%{__install} -Dd -m 0755 %{buildroot}%{home}

%{__rm} -rf %{buildroot}

/usr/sbin/groupadd -r pdns &>/dev/null || :
/usr/sbin/useradd -g pdns -s /bin/false -r -c "pdns" -d %{home} pdns &>/dev/null || :
%if 0%{?suse_version} && %{with systemd}
%service_add_pre %{name}.service

%if 0%{?suse_version} && %{with systemd}
systemd-tmpfiles --create /usr/lib/tmpfiles.d/pdns-recursor.conf || true
%service_add_post %{name}.service

%if 0%{?suse_version}
%if %{with systemd}
%service_del_preun %{name}.service
%stop_on_removal %{name}

%if 0%{?suse_version}
%if %{with systemd}
%service_del_postun %{name}.service
%restart_on_update %{name}

%defattr (-,root,root,-)
%dir %attr(750,root,pdns) %{_sysconfdir}/pdns
%attr(700,pdns,pdns) %dir %ghost %{_localstatedir}
%config(noreplace)  %attr(640,root,pdns) %{_sysconfdir}/pdns/*.conf
%if %{with systemd}
%config(noreplace) %{_sysconfdir}/init.d/%{name}
%dir %{_localstatedir}
%doc README COPYING rrd/ powerdns-example-script.lua
%dir %attr(750,pdns,pdns) %{home}