]> git.ipfire.org Git - thirdparty/pdns.git/blame - builder-support/specs/pdns-recursor.spec
make sure recursor.d subdir exists
[thirdparty/pdns.git] / builder-support / specs / pdns-recursor.spec
CommitLineData
9d52f503 1Name: pdns-recursor
8ceb365e
PL
2Version: %{getenv:BUILDER_RPM_VERSION}
3Release: %{getenv:BUILDER_RPM_RELEASE}%{?dist}
9d52f503
PL
4Summary: Modern, advanced and high performance recursing/non authoritative name server
5Group: System Environment/Daemons
6License: GPLv2
7URL: https://powerdns.com
8ceb365e 8Source0: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2
9d52f503
PL
9
10Provides: powerdns-recursor = %{version}-%{release}
988ce0bb 11
6f7f89d9
PD
12%if 0%{?rhel} < 8
13BuildRequires: boost169-devel
14%else
9d52f503 15BuildRequires: boost-devel
6f7f89d9 16%endif
88301a04 17BuildRequires: libcap-devel
988ce0bb
PL
18BuildRequires: systemd
19BuildRequires: systemd-devel
988ce0bb
PL
20BuildRequires: openssl-devel
21BuildRequires: net-snmp-devel
22BuildRequires: libsodium-devel
2abb0e83 23BuildRequires: fstrm-devel
eaf9356d 24BuildRequires: libcurl-devel
988ce0bb 25
23e7e4b3
PD
26%ifarch aarch64
27BuildRequires: lua-devel
7838d044 28%define lua_implementation lua
23e7e4b3 29%else
9d52f503 30BuildRequires: luajit-devel
7838d044 31%define lua_implementation luajit
23e7e4b3 32%endif
9d52f503 33
9d52f503
PL
34%ifarch ppc64 ppc64le
35BuildRequires: libatomic
36%endif
37
9d52f503 38Requires(pre): shadow-utils
9d52f503 39%systemd_requires
9d52f503
PL
40
41%description
42PowerDNS Recursor is a non authoritative/recursing DNS server. Use this
43package if you need a dns cache for your network.
44
45
46%prep
1d17618e 47%autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
9d52f503
PL
48
49%build
6f7f89d9
PD
50%if 0%{?rhel} < 8
51export CPPFLAGS=-I/usr/include/boost169
52export LDFLAGS=-L/usr/lib64/boost169
53%endif
54
9d52f503 55%configure \
e5d38a0f 56 --enable-option-checking=fatal \
9d52f503 57 --sysconfdir=%{_sysconfdir}/%{name} \
cb264691 58 --with-libsodium \
bdbd3e3c 59 --with-net-snmp \
9d52f503
PL
60 --disable-silent-rules \
61 --disable-static \
62 --enable-unit-tests \
af1a9ee7 63 --enable-dns-over-tls \
d9707e17 64 --enable-dnstap \
88301a04 65 --with-libcap \
7838d044 66 --with-lua=%{lua_implementation} \
9d52f503
PL
67 --enable-systemd --with-systemd=%{_unitdir}
68
69make %{?_smp_mflags}
9d52f503
PL
70
71%check
72make %{?_smp_mflags} check || (cat test-suite.log && false)
73
74%install
75make install DESTDIR=%{buildroot}
76
77%{__mv} %{buildroot}%{_sysconfdir}/%{name}/recursor.conf{-dist,}
f87a2f30 78%{__mkdir} %{buildroot}%{_sysconfdir}/%{name}/recursor.d
9d52f503 79
1d17618e 80# change user and group to pdns-recursor and add default include-dir
9d52f503
PL
81sed -i \
82 -e 's/# setuid=/setuid=pdns-recursor/' \
83 -e 's/# setgid=/setgid=pdns-recursor/' \
1d17618e 84 -e 's!# include-dir=.*!&\ninclude-dir=%{_sysconfdir}/%{name}/recursor.d!' \
9d52f503
PL
85 %{buildroot}%{_sysconfdir}/%{name}/recursor.conf
86
42bc9fae
O
87# The EL7 and 8 systemd actually supports %t, but its version number is older than that, so we do use seperate runtime dirs, but don't rely on RUNTIME_DIRECTORY
88%if 0%{?rhel} < 9
89sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor!' -i %{buildroot}/%{_unitdir}/pdns-recursor.service
90%if 0%{?rhel} < 8
91sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor-%i!' -e 's!RuntimeDirectory=pdns-recursor!&-%i!' -i %{buildroot}/%{_unitdir}/pdns-recursor@.service
92%endif
93%endif
94
9d52f503
PL
95%pre
96getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor
97getent passwd pdns-recursor > /dev/null || \
98 useradd -r -g pdns-recursor -d / -s /sbin/nologin \
99 -c "PowerDNS Recursor user" pdns-recursor
100exit 0
101
102%post
b5179dca 103systemctl daemon-reload ||:
9d52f503 104%systemd_post %{name}.service
9d52f503
PL
105
106%preun
9d52f503 107%systemd_preun %{name}.service
9d52f503 108
9d52f503
PL
109%postun
110%systemd_postun_with_restart pdns-recursor.service
9d52f503
PL
111
112%files
113%{_bindir}/rec_control
114%{_sbindir}/pdns_recursor
115%{_mandir}/man1/pdns_recursor.1.gz
116%{_mandir}/man1/rec_control.1.gz
9d52f503
PL
117%{_unitdir}/pdns-recursor.service
118%{_unitdir}/pdns-recursor@.service
9d52f503 119%dir %{_sysconfdir}/%{name}
1d17618e 120%dir %{_sysconfdir}/%{name}/recursor.d
9d52f503
PL
121%config(noreplace) %{_sysconfdir}/%{name}/recursor.conf
122%doc README