]> granicus.if.org Git - pdns/commitdiff
dnsdist: Ship multiple unit files for debian
authorPieter Lexis <pieter.lexis@powerdns.com>
Tue, 14 Nov 2017 11:39:49 +0000 (12:39 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 14 Nov 2017 11:39:49 +0000 (12:39 +0100)
build-scripts/build-dnsdist-debian
build-scripts/debian-dnsdist/dnsdist.install.in [moved from build-scripts/debian-dnsdist/dnsdist.install with 100% similarity]
build-scripts/debian-dnsdist/dnsdist.service [deleted file]
build-scripts/debian-dnsdist/rules

index 18e1d9304541974a7b9f00519bd72d6bbbe21ba4..68c1ac0518a7b4c0fb1d5fabfc4c6ca9a1496996 100755 (executable)
@@ -35,6 +35,7 @@ if [ ${ID} = "ubuntu" -a ${VERSION_ID} = "14.04" ]; then
 fi
 
 fakeroot debian/rules debian/control
+fakeroot debian/rules debian/dnsdist.install
 fakeroot debian/rules binary
 
 cd -
diff --git a/build-scripts/debian-dnsdist/dnsdist.service b/build-scripts/debian-dnsdist/dnsdist.service
deleted file mode 100644 (file)
index 8a265b4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-[Unit]
-Description=dnsdist
-Wants=network-online.target
-After=network-online.target
-
-[Service]
-# Note: when editing the ExecStart command, keep --supervised and --disable-syslog
-ExecStart=/usr/bin/dnsdist --supervised --disable-syslog -u _dnsdist -g _dnsdist
-
-Type=notify
-Restart=on-failure
-RestartSec=2
-TimeoutStopSec=5
-StartLimitInterval=0
-PrivateTmp=true
-PrivateDevices=true
-CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID
-NoNewPrivileges=true
-ProtectSystem=full
-ProtectHome=true
-RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
-
-[Install]
-WantedBy=multi-user.target
index 49836e04bde37bc609388d49f6ea9ed8c85e8392..cf0c6c704de71f11ff5fcc3004f3dc3bcf85c13a 100755 (executable)
@@ -13,6 +13,9 @@ LIBSODIUM_DEV := , libsodium-dev
 ENABLE_SYSTEMD := --enable-systemd --with-systemd=/lib/systemd/system
 LIBSYSTEMD_DEV := , libsystemd-dev
 DEBHELPER_WITH_SYSTEMD := --with systemd
+DH_INSTALLINIT_OVERRIDE := dh_systemd_start --restart-after-upgrade dnsdist.service # Do not stop the service in prerm, but restart during postinst on upgrade
+PREPARE_SERVICE := sed -i 's!^ExecStart.*!& -u _dnsdist -g _dnsdist!' dnsdist.service.in
+FILES_SYSTEMD := 'lib/systemd/system/dnsdist*'
 
 ENABLE_RE2 := --enable-re2
 LIBRE2_DEV := , libre2-dev
@@ -28,6 +31,9 @@ ifeq ($(ID), ubuntu)
     DEBHELPER_WITH_SYSTEMD=
     ENABLE_RE2=
     LIBRE2_DEV=
+    DH_INSTALLINIT_OVERRIDE=true
+    PREPARE_SERVICE=true
+    FILES_SYSTEMD=''
   endif
 endif
 
@@ -36,6 +42,10 @@ debian/control: debian/control.in
            -e "s!@LIBSYSTEMDDEV@!$(LIBSYSTEMD_DEV)!" \
            -e "s!@LIBRE2DEV@!$(LIBRE2_DEV)!" $< > $@
 
+debian/dnsdist.install: debian/dnsdist.install.in
+       cp $< $@
+       echo $(FILES_SYSTEMD) >> $@
+
 %:
        dh $@ \
          --with autotools-dev \
@@ -43,6 +53,7 @@ debian/control: debian/control.in
          $(DEBHELPER_WITH_SYSTEMD)
 
 override_dh_auto_configure:
+       $(PREPARE_SERVICE)
        ./configure \
          --host=$(DEB_HOST_GNU_TYPE) \
          --build=$(DEB_BUILD_GNU_TYPE) \
@@ -67,3 +78,7 @@ override_dh_strip:
 
 override_dh_auto_test:
        $(MAKE) check || (cat test-suite.log && false)
+
+override_dh_installinit:
+       dh_installinit
+       $(DH_INSTALLINIT_OVERRIDE)