From: Pieter Lexis Date: Thu, 28 Dec 2017 13:27:52 +0000 (+0100) Subject: builder: Add recursor RPM builder X-Git-Tag: dnsdist-1.3.3~83^2~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d52f5039c610c1d82a33fefab143f8fc86e4b41;p=thirdparty%2Fpdns.git builder: Add recursor RPM builder --- diff --git a/builder-support/dockerfiles/Dockerfile.recursor b/builder-support/dockerfiles/Dockerfile.recursor index 0e8a3f5c61..b214140679 100644 --- a/builder-support/dockerfiles/Dockerfile.recursor +++ b/builder-support/dockerfiles/Dockerfile.recursor @@ -14,6 +14,6 @@ RUN mkdir /sdist ARG BUILDER_VERSION RUN /pdns-recursor/builder/helpers/set-configure-ac-version.sh && \ autoreconf -v -i --force && \ - ./configure --without-modules --without-dynmodules --disable-dependency-tracking && \ + ./configure --disable-dependency-tracking && \ make dist RUN cp pdns-recursor-${BUILDER_VERSION}.tar.bz2 /sdist/ diff --git a/builder-support/dockerfiles/Dockerfile.rpmbuild b/builder-support/dockerfiles/Dockerfile.rpmbuild index 3e060c611b..9709921340 100644 --- a/builder-support/dockerfiles/Dockerfile.rpmbuild +++ b/builder-support/dockerfiles/Dockerfile.rpmbuild @@ -29,6 +29,14 @@ RUN if $(grep -q 'release 6' /etc/redhat-release); then \ fi @ENDIF +@IF [ ! -z "$M_recursor" ] +RUN if $(grep -q 'release 6' /etc/redhat-release); then \ + scl enable devtoolset-3 -- builder/helpers/build-specs.sh builder-support/specs/pdns-recursor.spec; \ + else \ + builder/helpers/build-specs.sh builder-support/specs/pdns-recursor.spec; \ + fi +@ENDIF + @IF [ ! -z "$M_dnsdist" ] RUN if $(grep -q 'release 6' /etc/redhat-release); then \ scl enable devtoolset-3 -- builder/helpers/build-specs.sh builder-support/specs/dnsdist.spec; \ diff --git a/builder-support/specs/pdns-recursor.init b/builder-support/specs/pdns-recursor.init new file mode 100644 index 0000000000..0e0214cb70 --- /dev/null +++ b/builder-support/specs/pdns-recursor.init @@ -0,0 +1,66 @@ +#!/bin/bash +# +# pdns-recursor This shell script controls the PowerDNS Recursor +# +# Author: Ruben Kerkhof +# +# chkconfig: - 49 51 +# +# description: PowerDNS Recursor is a non authoritative/recursing DNS server +# processname: pdns-recursor +# config: /etc/pdns-recursor/recursor.conf +# pidfile: /var/run/pdns_recursor.pid +# + +# . function library +. /etc/rc.d/init.d/functions + +RETVAL=0 + +PIDDIR=$(awk -F= '/^socket-dir=/ {print $2}' /etc/pdns-recursor/recursor.conf) +if [ -z "$PIDDIR" ]; then PIDDIR=/var/run; fi +mkdir -p "$PIDDIR" + +start() { + echo -n $"Starting pdns-recursor: " + daemon /usr/sbin/pdns_recursor --daemon 2>/dev/null + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pdns-recursor +} + +stop() { + echo -n $"Stopping pdns-recursor: " + killproc pdns_recursor + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pdns-recursor && rm -f $PIDDIR/pdns_recursor.controlsocket +} + +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload|reload) + restart + ;; + condrestart) + [ -f /var/lock/subsys/pdns-recursor ] && restart + ;; + status) + status pdns_recursor + RETVAL=$? + ;; + *) + echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" + exit 1 +esac + +exit $RETVAL diff --git a/builder-support/specs/pdns-recursor.spec b/builder-support/specs/pdns-recursor.spec new file mode 100644 index 0000000000..2542e81ba3 --- /dev/null +++ b/builder-support/specs/pdns-recursor.spec @@ -0,0 +1,142 @@ +Name: pdns-recursor +Version: %{getenv:BUILDER_VERSION} +Release: %{getenv:BUILDER_RELEASE}%{?dist} +Summary: Modern, advanced and high performance recursing/non authoritative name server +Group: System Environment/Daemons +License: GPLv2 +URL: https://powerdns.com +Source0: %{name}-%{version}.tar.bz2 +%if 0%{?rhel} == 6 +Source1: pdns-recursor.init +%endif + +Provides: powerdns-recursor = %{version}-%{release} +%if 0%{?rhel} == 6 +BuildRequires: boost148-devel +BuildRequires: lua-devel +%else +BuildRequires: boost-devel +BuildRequires: luajit-devel +BuildRequires: systemd +BuildRequires: systemd-devel +%endif + +# Note: The ifarch for luajit is removed becuae of EL6 not having luajit + +%ifarch ppc64 ppc64le +BuildRequires: libatomic +%endif + +BuildRequires: openssl-devel +BuildRequires: net-snmp-devel +BuildRequires: protobuf-compiler +BuildRequires: protobuf-devel +BuildRequires: libsodium-devel + +Requires(pre): shadow-utils +%if 0%{?rhel} == 6 +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/service, /sbin/chkconfig +Requires(postun): /sbin/service +%else +%systemd_requires +%endif + +%description +PowerDNS Recursor is a non authoritative/recursing DNS server. Use this +package if you need a dns cache for your network. + + +%prep +%if 0%{?rhel} == 6 +%setup -q -n %{name}-%{version} +%else +%autosetup -p1 +%endif + +%build +%configure \ + --sysconfdir=%{_sysconfdir}/%{name} \ + --enable-libsodium \ + --with-protobuf \ + --with-netsnmp \ + --disable-silent-rules \ + --disable-static \ + --enable-unit-tests \ +%if 0%{?rhel} == 6 + --with-boost=/usr/include/boost148 LIBRARY_PATH=/usr/lib64/boost148 + +make %{?_smp_mflags} LIBRARY_PATH=/usr/lib64/boost148 +%else + --with-luajit \ + --enable-systemd --with-systemd=%{_unitdir} + +make %{?_smp_mflags} +%endif + +%check +make %{?_smp_mflags} check || (cat test-suite.log && false) + +%install +make install DESTDIR=%{buildroot} + +%{__mv} %{buildroot}%{_sysconfdir}/%{name}/recursor.conf{-dist,} + +%if 0%{?rhel} == 6 +%{__install} -D -p %{SOURCE1} %{buildroot}%{_initrddir}/pdns-recursor +%endif + +# change user and group to pdns-recursor +sed -i \ + -e 's/# setuid=/setuid=pdns-recursor/' \ + -e 's/# setgid=/setgid=pdns-recursor/' \ + %{buildroot}%{_sysconfdir}/%{name}/recursor.conf + +%pre +getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor +getent passwd pdns-recursor > /dev/null || \ + useradd -r -g pdns-recursor -d / -s /sbin/nologin \ + -c "PowerDNS Recursor user" pdns-recursor +exit 0 + +%post +%if 0%{?rhel} == 6 +chkconfig --add %{name} +%else +%systemd_post %{name}.service +%endif + +%preun +%if 0%{?rhel} == 6 +if [ $1 -eq 0 ]; then + service %{name} stop >/dev/null 2>&1 || : + chkconfig --del %{name} +fi +%else +%systemd_preun %{name}.service +%endif + +%if 0%{?rhel} == 6 +%postun +if [ $1 -ge 1 ]; then + service %{name} condrestart >/dev/null 2>&1 || : +fi +%else +%postun +%systemd_postun_with_restart pdns-recursor.service +%endif + +%files +%{_bindir}/rec_control +%{_sbindir}/pdns_recursor +%{_mandir}/man1/pdns_recursor.1.gz +%{_mandir}/man1/rec_control.1.gz +%if 0%{?rhel} == 6 +%{_initrddir}/pdns-recursor +%else +%{_unitdir}/pdns-recursor.service +%{_unitdir}/pdns-recursor@.service +%endif +%dir %{_sysconfdir}/%{name} +%config(noreplace) %{_sysconfdir}/%{name}/recursor.conf +%doc README