]> granicus.if.org Git - pdns/commitdiff
auth Install systemd unit file
authorPieter Lexis <pieter.lexis@powerdns.com>
Mon, 25 Apr 2016 14:09:17 +0000 (16:09 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 4 May 2016 14:03:09 +0000 (16:03 +0200)
Makefile.am
build-scripts/build-auth-debian
build-scripts/build-auth-rpm
build-scripts/debian-authoritative/control.in [moved from build-scripts/debian-authoritative/control with 99% similarity]
build-scripts/debian-authoritative/pdns-server.install
build-scripts/debian-authoritative/pdns-server.pdns.service [deleted file]
build-scripts/debian-authoritative/rules
pdns/.gitignore
pdns/Makefile.am
pdns/pdns.service.in [moved from contrib/systemd-pdns.service with 92% similarity]

index b808b183b50a44554a3cf9047c4a137d8a4f058f..7d3812d1b144642be96758403fd58324e0f6130e 100644 (file)
@@ -12,7 +12,6 @@ EXTRA_DIST = \
        build-aux/gen-version \
        codedocs/doxygen.conf \
        contrib/powerdns.solaris.init.d \
-       contrib/systemd-pdns.service \
        pdns/named.conf.parsertest \
        regression-tests/zones/unit.test
 
index c5696aeceb50bbc0b3501e85780ce3089a23602b..3f86f5dc5edc9d1c05fba31071b889700198538b 100755 (executable)
@@ -28,11 +28,6 @@ cp -r build-scripts/debian-authoritative $DISTDIR/debian
 
 cd $DISTDIR
 
-if $(echo $VERSION | grep -q -E '^0\.0\.'); then
-  # make sure we don't break dependencies for master releases
-  sed -i '/pdns-server (<< 3.4.6-2)/d' debian/control
-fi
-
 cat > debian/changelog << EOF
 pdns (${VERSION}-${RELEASE}) unstable; urgency=medium
 
@@ -41,4 +36,18 @@ pdns (${VERSION}-${RELEASE}) unstable; urgency=medium
  -- ${DEBFULLNAME} <${DEBEMAIL}>  $(date -R)
 
 EOF
+
+PDNS_VERSION=$VERSION
+
+. /etc/os-release
+export ID="${ID}"
+export VERSION_ID="${VERSION_ID}"
+
+fakeroot debian/rules debian/control
+
+if $(echo $PDNS_VERSION | grep -q -E '^0\.0\.'); then
+  # make sure we don't break dependencies for master releases
+  sed -i '/pdns-server (<< 3.4.6-2)/d' debian/control
+fi
+
 DH_OPTIONS=--parallel fakeroot debian/rules binary
index e29c2dec521ef362b9e7e407fbe874a74cfe6ea6..8354d4f93e3a9ef32dd03ed40042e125b547f50b 100755 (executable)
@@ -312,6 +312,7 @@ Requires(preun): systemd-units
 Requires(postun): systemd-units
 
 BuildRequires: systemd-units
+BuildRequires: systemd-devel
 BuildRequires: boost-devel
 BuildRequires: lua-devel
 BuildRequires: bison
@@ -437,20 +438,20 @@ export CPPFLAGS="-DLDAP_DEPRECATED"
        --with-lua \
        --with-dynmodules='%{backends} random' \
        --enable-tools \
-       --enable-unit-tests
+       --enable-unit-tests \
+       --enable-systemd
 
 make %{?_smp_mflags}
 
 %install
-
 make install DESTDIR=%{buildroot}
 
 %{__rm} -f %{buildroot}%{_libdir}/%{name}/*.la
 %{__rm} -rf %{buildroot}%{_docdir}
 %{buildroot}/usr/sbin/pdns_server --no-config --config | sed \
   -e 's!# config-dir=.*!config-dir=%{_sysconfdir}%{name}!' \
-  -e 's!# daemon=.*!daemon=yes!' \
-  -e 's!# guardian=.*!guardian=yes!' \
+  -e 's!# daemon=.*!daemon=no!' \
+  -e 's!# guardian=.*!guardian=no!' \
   -e 's!# launch=.*!&\\nlaunch=!' \
   -e 's!# setgid=.*!setgid=pdns!' \
   -e 's!# setuid=.*!setuid=pdns!' \
@@ -463,9 +464,6 @@ chmod 600 %{buildroot}%{_sysconfdir}/%{name}/pdns.conf
 %{__mv} %{buildroot}/%{_bindir}/zone2ldap %{buildroot}/%{_bindir}/pdns-zone2ldap
 %{__mv} %{buildroot}/%{_mandir}/man1/zone2ldap.1 %{buildroot}/%{_mandir}/man1/pdns-zone2ldap.1
 
-# install systemd unit file
-%{__install} -D -p -m 644 contrib/systemd-pdns.service %{buildroot}%{_unitdir}/%{name}.service
-
 %check
 make %{?_smp_mflags} -C pdns check
 
@@ -597,6 +595,7 @@ BuildRequires: lua-devel
 BuildRequires: bison
 BuildRequires: openssl-devel
 BuildRequires: systemd-rpm-macros
+BuildRequires: systemd-devel
 Provides: powerdns = %{version}-%{release}
 %global backends %{backends} bind
 
@@ -695,7 +694,8 @@ export CPPFLAGS="-DLDAP_DEPRECATED"
        --with-lua \
        --with-dynmodules='%{backends} random' \
        --enable-tools \
-       --enable-unit-tests
+       --enable-unit-tests \
+       --enable-systemd
 
 make %{?_smp_mflags}
 
@@ -720,9 +720,6 @@ chmod 600 %{buildroot}%{_sysconfdir}/%{name}/pdns.conf
 %{__mv} %{buildroot}/%{_bindir}/zone2ldap %{buildroot}/%{_bindir}/pdns-zone2ldap
 %{__mv} %{buildroot}/%{_mandir}/man1/zone2ldap.1 %{buildroot}/%{_mandir}/man1/pdns-zone2ldap.1
 
-# install systemd unit file
-%{__install} -D -p -m 644 contrib/systemd-pdns.service %{buildroot}%{_unitdir}/%{name}.service
-
 %check
 make %{?_smp_mflags} -C pdns check
 
similarity index 99%
rename from build-scripts/debian-authoritative/control
rename to build-scripts/debian-authoritative/control.in
index af7aedf30435620a79d0dcf28eadb250f505793b..d1c0272a367f539409206b2b9c1dc9c39eae77bc 100644 (file)
@@ -4,7 +4,7 @@ Priority: extra
 Standards-Version: 3.9.6
 Maintainer: PowerDNS Autobuilder <powerdns.support@powerdns.com>
 Origin: PowerDNS
-Build-Depends: debhelper (>= 9~), dh-autoreconf, dh-systemd, po-debconf, libtool, flex, bison, libmysqlclient-dev, libpq-dev, libssl-dev, libpolarssl-dev, libgdbm-dev, libldap2-dev, libsqlite3-dev, dpkg-dev (>= 1.17.0~), libboost-dev, libboost-serialization-dev, libboost-program-options-dev, libboost-test-dev, autotools-dev, automake, autoconf, liblua5.2-dev, pkg-config, ragel, libgmp-dev, libbotan1.10-dev, libcurl4-openssl-dev, libzmq-dev, libyaml-cpp-dev (>= 0.5), libgeoip-dev, libopendbx1-dev, libcdb-dev, unixodbc-dev (>= 2.3.1)
+Build-Depends: debhelper (>= 9~), dh-autoreconf, dh-systemd, po-debconf, libtool, flex, bison, libmysqlclient-dev, libpq-dev, libssl-dev, libpolarssl-dev, libgdbm-dev, libldap2-dev, libsqlite3-dev, dpkg-dev (>= 1.17.0~), libboost-dev, libboost-serialization-dev, libboost-program-options-dev, libboost-test-dev, autotools-dev, automake, autoconf, liblua5.2-dev, pkg-config, ragel, libgmp-dev, libbotan1.10-dev, libcurl4-openssl-dev, libzmq-dev, libyaml-cpp-dev (>= 0.5), libgeoip-dev, libopendbx1-dev, libcdb-dev, unixodbc-dev (>= 2.3.1) @LIBSYSTEMDDEV@
 Homepage: http://www.powerdns.com/
 
 Package: pdns-server
index 70034d8dbb6eafa95ed9c8841b61b016b5788991..79ea031e21f430d6a37eb32af921e27831a75c6d 100644 (file)
@@ -9,3 +9,4 @@ debian/config/pdns usr/share/pdns-server/
 debian/config/pdns.simplebind.conf usr/share/pdns-server/
 debian/resolvconf/pdns etc/resolvconf/update.d/
 debian/insserv.d/pdns-server etc/insserv.d/
+lib/systemd/system/pdns.service
diff --git a/build-scripts/debian-authoritative/pdns-server.pdns.service b/build-scripts/debian-authoritative/pdns-server.pdns.service
deleted file mode 100644 (file)
index 9d3ba43..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=PowerDNS Authoritative Server
-After=network-online.target
-
-[Service]
-Type=simple
-ExecStart=/usr/sbin/pdns_server --daemon=no
-ExecStop=/usr/bin/pdns_control quit
-TimeoutStopSec=5
-Restart=on-failure
-RestartSec=2
-PrivateTmp=true
-
-[Install]
-WantedBy=multi-user.target
index ffe6a0459c57ad6932183a93d33cc225907fa5bb..9b3d8b4ca150fff1e97850873f68d99311ea8407 100755 (executable)
@@ -9,9 +9,29 @@ backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lua mydns remote r
 
 DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
+ENABLE_SYSTEMD := --enable-systemd --with-systemd=/lib/systemd/system
+LIBSYSTEMD_DEV := , libsystemd-dev
+DEBHELPER_WITH_SYSTEMD := --with systemd
+
+# $(ID) and $(VERSION_ID) come from the environment, source this from /etc/os-release
+ifeq ($(ID), ubuntu)
+  ifeq ($(VERSION_ID), 14.04)
+    # Disable building with and depending on systemd on Ubuntu Trusty
+    ENABLE_SYSTEMD=
+    LIBSYSTEMD_DEV=
+    DEBHELPER_WITH_SYSTEMD=
+  endif
+endif
+
+debian/control: debian/control.in
+       sed -e "s!@LIBSYSTEMDDEV@!$(LIBSYSTEMD_DEV)!" $< > $@
+
 # Use new build system
 %:
-       dh $@ --with autoreconf --parallel
+       dh $@ \
+         --with autoreconf \
+         --parallel \
+         $(DEBHELPER_WITH_SYSTEMD)
 
 override_dh_auto_configure:
        test -f pdns/dnslabeltext.cc && mv pdns/dnslabeltext.cc debian/dnslabeltext.cc.moved || true
@@ -29,7 +49,8 @@ override_dh_auto_configure:
                --with-pgsql-includes=`pg_config --includedir` \
                --enable-botan1.10 \
                --enable-tools \
-               --enable-unit-tests
+               --enable-unit-tests \
+               $(ENABLE_SYSTEMD)
 
 # pdns-server has a debug package
 override_dh_strip:
index ccd61849424186e4d1232f764998457f349a1724..f3b291434675f4614ab39a2900a95dcb9f833b8b 100644 (file)
@@ -57,4 +57,4 @@ version_generated.h
 effective_tld_names.dat
 /dnsmessage.pb.cc
 /dnsmessage.pb.h
-
+/pdns.service
index 92a7290b881b0c5745882757ac6367e76a5cbbd5..f06feb34d8085c98a6943fcfcda6f25dba3deb9a 100644 (file)
@@ -50,7 +50,8 @@ EXTRA_DIST = \
        bindparser.h \
        named.conf.parsertest \
        pdns.conf-dist \
-       delaypipe.hh delaypipe.cc
+       delaypipe.hh delaypipe.cc \
+       pdns.service.in
 
 BUILT_SOURCES = \
        bind-dnssec.schema.sqlite3.sql.h \
@@ -1178,3 +1179,13 @@ pdns_recursor rec_control:
 dnsdist:
        @echo "Please build dnsdist from the dnsdistdist/ dir"
        @exit 1
+
+if HAVE_SYSTEMD
+pdns.service: pdns.service.in
+       $(AM_V_GEN)sed -e 's![@]sbindir[@]!$(sbindir)!' < $< > $@
+
+systemdsystemunitdir = $(SYSTEMD_DIR)
+
+systemdsystemunit_DATA = \
+       pdns.service
+endif
similarity index 92%
rename from contrib/systemd-pdns.service
rename to pdns/pdns.service.in
index f16f07c77a673292d2c9e55137b768674b95532a..a1ff509bc5b81204d1a4639c4398181c71968696 100644 (file)
@@ -7,7 +7,7 @@ After=network-online.target mysqld.service postgresql.service slapd.service
 
 [Service]
 Type=notify
-ExecStart=/usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --write-pid=no
+ExecStart=@sbindir@/pdns_server --guardian=no --daemon=no --disable-syslog --write-pid=no
 Restart=on-failure
 StartLimitInterval=0
 PrivateTmp=true