]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
builder: Add recursor RPM builder
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 28 Dec 2017 13:27:52 +0000 (14:27 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 27 Sep 2018 11:59:27 +0000 (13:59 +0200)
builder-support/dockerfiles/Dockerfile.recursor
builder-support/dockerfiles/Dockerfile.rpmbuild
builder-support/specs/pdns-recursor.init [new file with mode: 0644]
builder-support/specs/pdns-recursor.spec [new file with mode: 0644]

index 0e8a3f5c611538ebac29b4a5d1dd468abb24c514..b214140679a478febe626457fd492a9c475f44b6 100644 (file)
@@ -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/
index 3e060c611becc10a26f426fbad290bc5a7d2a82c..9709921340d355732b6ecebe82034634094e8eb7 100644 (file)
@@ -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 (file)
index 0000000..0e0214c
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# pdns-recursor  This shell script controls the PowerDNS Recursor
+#
+# Author:       Ruben Kerkhof <ruben@rubenkerkhof.com>
+#
+# 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 (file)
index 0000000..2542e81
--- /dev/null
@@ -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