]> git.ipfire.org Git - thirdparty/pdns.git/blob - builder-support/specs/pdns-recursor.spec
Condition to HAVE_SYSTEMD_WITH_RUNTIME_DIR_ENV is reversed
[thirdparty/pdns.git] / builder-support / specs / pdns-recursor.spec
1 Name: pdns-recursor
2 Version: %{getenv:BUILDER_RPM_VERSION}
3 Release: %{getenv:BUILDER_RPM_RELEASE}%{?dist}
4 Summary: Modern, advanced and high performance recursing/non authoritative name server
5 Group: System Environment/Daemons
6 License: GPLv2
7 URL: https://powerdns.com
8 Source0: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2
9
10 Provides: powerdns-recursor = %{version}-%{release}
11
12 BuildRequires: boost-devel
13 BuildRequires: libcap-devel
14 BuildRequires: systemd
15 BuildRequires: systemd-devel
16 BuildRequires: openssl-devel
17 BuildRequires: net-snmp-devel
18 BuildRequires: libsodium-devel
19 BuildRequires: fstrm-devel
20 BuildRequires: libcurl-devel
21
22 %ifarch aarch64
23 BuildRequires: lua-devel
24 %define lua_implementation lua
25 %else
26 BuildRequires: luajit-devel
27 %define lua_implementation luajit
28 %endif
29
30 %ifarch ppc64 ppc64le
31 BuildRequires: libatomic
32 %endif
33
34 Requires(pre): shadow-utils
35 %systemd_requires
36
37 %description
38 PowerDNS Recursor is a non authoritative/recursing DNS server. Use this
39 package if you need a dns cache for your network.
40
41
42 %prep
43 %autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
44
45 %build
46 %configure \
47 --enable-option-checking=fatal \
48 --sysconfdir=%{_sysconfdir}/%{name} \
49 --with-libsodium \
50 --with-net-snmp \
51 --disable-silent-rules \
52 --disable-static \
53 --enable-unit-tests \
54 --enable-dns-over-tls \
55 --enable-dnstap \
56 --with-libcap \
57 --with-lua=%{lua_implementation} \
58 --enable-systemd --with-systemd=%{_unitdir}
59
60 make %{?_smp_mflags}
61
62 %check
63 make %{?_smp_mflags} check || (cat test-suite.log && false)
64
65 %install
66 make install DESTDIR=%{buildroot}
67
68 %{__mv} %{buildroot}%{_sysconfdir}/%{name}/recursor.conf{-dist,}
69
70 # change user and group to pdns-recursor
71 sed -i \
72 -e 's/# setuid=/setuid=pdns-recursor/' \
73 -e 's/# setgid=/setgid=pdns-recursor/' \
74 %{buildroot}%{_sysconfdir}/%{name}/recursor.conf
75
76 # 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
77 %if 0%{?rhel} < 9
78 sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor!' -i %{buildroot}/%{_unitdir}/pdns-recursor.service
79 %if 0%{?rhel} < 8
80 sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor-%i!' -e 's!RuntimeDirectory=pdns-recursor!&-%i!' -i %{buildroot}/%{_unitdir}/pdns-recursor@.service
81 %endif
82 %endif
83
84 %pre
85 getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor
86 getent passwd pdns-recursor > /dev/null || \
87 useradd -r -g pdns-recursor -d / -s /sbin/nologin \
88 -c "PowerDNS Recursor user" pdns-recursor
89 exit 0
90
91 %post
92 systemctl daemon-reload ||:
93 %systemd_post %{name}.service
94
95 %preun
96 %systemd_preun %{name}.service
97
98 %postun
99 %systemd_postun_with_restart pdns-recursor.service
100
101 %files
102 %{_bindir}/rec_control
103 %{_sbindir}/pdns_recursor
104 %{_mandir}/man1/pdns_recursor.1.gz
105 %{_mandir}/man1/rec_control.1.gz
106 %{_unitdir}/pdns-recursor.service
107 %{_unitdir}/pdns-recursor@.service
108 %dir %{_sysconfdir}/%{name}
109 %config(noreplace) %{_sysconfdir}/%{name}/recursor.conf
110 %doc README