]> source.dussan.org Git - rspamd.git/commitdiff
Work around Debian mishandling of systemd socket-activated units
authorMikhail Gusarov <dottedmag@debian.org>
Sat, 7 Mar 2015 10:23:13 +0000 (10:23 +0000)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 17 Mar 2015 16:58:34 +0000 (18:58 +0200)
If there is a backward compatibility sysvinit script, then
even socket-activated services are started automatically after
install/upgrade.

debian/postinst
debian/postrm
debian/prerm [new file with mode: 0644]
debian/rules

index 7d6db234797ec943c013e2efc014103f338fadd6..6d725a90d373dd110f9e2b6504b053d4d59016df 100644 (file)
@@ -29,6 +29,15 @@ case "$1" in
     ;;
 esac
 
+if [ -x /etc/init.d/rspamd ]; then
+    update-rc.d rspamd defaults >/dev/null
+    if [ -d /run/systemd/systemd ]; then
+        systemctl --system daemon-reload >/dev/null || true
+    else
+        invoke-rc.d rspamd start || exit $?
+    fi
+fi
+
 #DEBHELPER#
 
 exit 0
index 10a84805e35e6e3d27f849615b9241991c263866..0ab952d467e057929a343c3bfd83c6200908ae68 100644 (file)
@@ -1,6 +1,14 @@
 #!/bin/sh
 set -e
 
+if [ "$1" = "purge" ]; then
+   update-rc.d rspamd remove >/dev/null
+fi
+
+if [ -d /run/systemd/system ]; then
+    systemctl --system daemon-reload >/dev/null || true
+fi
+
 #DEBHELPER#
 
 case "$1" in
diff --git a/debian/prerm b/debian/prerm
new file mode 100644 (file)
index 0000000..9417215
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+if [ -x /etc/init.d/rspamd ] && ! [ -d /run/systemd/system ]; then
+    invoke-rc.d rspamd stop || exit $?
+fi
+
+#DEBHELPER#
index 9eb1014f105feaf8554176147cbeaaafe98fd8b0..e3959eb572c8091a8d400d7ce435b0071f5a86df 100755 (executable)
@@ -32,5 +32,11 @@ override_dh_fixperms:
        dh_fixperms
        chmod 750 $(CURDIR)/debian/rspamd/var/lib/rspamd
 
+override_dh_systemd_enable:
+       dh_systemd_enable rspamd.socket
+
 override_dh_systemd_start:
-       dh_systemd_start --restart-after-upgrade
+       dh_systemd_start --restart-after-upgrade --no-start
+
+override_dh_installinit:
+       dh_installinit -n