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