]> git.ipfire.org Git - thirdparty/pdns.git/blob - builder-support/specs/pdns-recursor.spec
c9b6acdb4193ba188093a0799433b84463db7b4f
[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 %if 0%{?rhel} == 6
10 Source1: pdns-recursor.init
11 %endif
12
13 Provides: powerdns-recursor = %{version}-%{release}
14 %if 0%{?rhel} == 6
15 BuildRequires: boost148-devel
16 BuildRequires: lua-devel
17 %else
18 BuildRequires: boost-devel
19 BuildRequires: libcap-devel
20 %ifarch aarch64
21 BuildRequires: lua-devel
22 %define lua_implementation lua
23 %else
24 BuildRequires: luajit-devel
25 %define lua_implementation luajit
26 %endif
27 BuildRequires: systemd
28 BuildRequires: systemd-devel
29 %endif
30
31 %ifarch ppc64 ppc64le
32 BuildRequires: libatomic
33 %endif
34
35 %if 0%{?rhel} >= 7
36 BuildRequires: protobuf-compiler
37 BuildRequires: protobuf-devel
38 %endif
39
40 BuildRequires: openssl-devel
41 BuildRequires: net-snmp-devel
42 BuildRequires: libsodium-devel
43
44 Requires(pre): shadow-utils
45 %if 0%{?rhel} == 6
46 Requires(post): /sbin/chkconfig
47 Requires(preun): /sbin/service, /sbin/chkconfig
48 Requires(postun): /sbin/service
49 %else
50 %systemd_requires
51 %endif
52
53 %description
54 PowerDNS Recursor is a non authoritative/recursing DNS server. Use this
55 package if you need a dns cache for your network.
56
57
58 %prep
59 %if 0%{?rhel} == 6
60 %setup -n %{name}-%{getenv:BUILDER_VERSION}
61 %else
62 %autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
63 %endif
64
65 %build
66 %configure \
67 --sysconfdir=%{_sysconfdir}/%{name} \
68 --with-libsodium \
69 --with-netsnmp \
70 --disable-silent-rules \
71 --disable-static \
72 --enable-unit-tests \
73 %if 0%{?rhel} == 6
74 --without-protobuf \
75 --with-boost=/usr/include/boost148 LIBRARY_PATH=/usr/lib64/boost148
76
77 make %{?_smp_mflags} LIBRARY_PATH=/usr/lib64/boost148
78 %else
79 --with-protobuf \
80 --with-libcap \
81 --with-lua=%{lua_implementation} \
82 --enable-systemd --with-systemd=%{_unitdir}
83
84 make %{?_smp_mflags}
85 %endif
86
87 %check
88 make %{?_smp_mflags} check || (cat test-suite.log && false)
89
90 %install
91 make install DESTDIR=%{buildroot}
92
93 %{__mv} %{buildroot}%{_sysconfdir}/%{name}/recursor.conf{-dist,}
94
95 %if 0%{?rhel} == 6
96 %{__install} -D -p %{SOURCE1} %{buildroot}%{_initrddir}/pdns-recursor
97 %endif
98
99 # change user and group to pdns-recursor
100 sed -i \
101 -e 's/# setuid=/setuid=pdns-recursor/' \
102 -e 's/# setgid=/setgid=pdns-recursor/' \
103 %{buildroot}%{_sysconfdir}/%{name}/recursor.conf
104
105 %pre
106 getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor
107 getent passwd pdns-recursor > /dev/null || \
108 useradd -r -g pdns-recursor -d / -s /sbin/nologin \
109 -c "PowerDNS Recursor user" pdns-recursor
110 exit 0
111
112 %post
113 %if 0%{?rhel} == 6
114 chkconfig --add %{name}
115 %else
116 %systemd_post %{name}.service
117 %endif
118
119 %preun
120 %if 0%{?rhel} == 6
121 if [ $1 -eq 0 ]; then
122 service %{name} stop >/dev/null 2>&1 || :
123 chkconfig --del %{name}
124 fi
125 %else
126 %systemd_preun %{name}.service
127 %endif
128
129 %if 0%{?rhel} == 6
130 %postun
131 if [ $1 -ge 1 ]; then
132 service %{name} condrestart >/dev/null 2>&1 || :
133 fi
134 %else
135 %postun
136 %systemd_postun_with_restart pdns-recursor.service
137 %endif
138
139 %files
140 %{_bindir}/rec_control
141 %{_sbindir}/pdns_recursor
142 %{_mandir}/man1/pdns_recursor.1.gz
143 %{_mandir}/man1/rec_control.1.gz
144 %if 0%{?rhel} == 6
145 %{_initrddir}/pdns-recursor
146 %else
147 %{_unitdir}/pdns-recursor.service
148 %{_unitdir}/pdns-recursor@.service
149 %endif
150 %dir %{_sysconfdir}/%{name}
151 %config(noreplace) %{_sysconfdir}/%{name}/recursor.conf
152 %doc README