aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@debian.org>2015-03-07 10:23:13 +0000
committerAndrew Lewis <nerf@judo.za.org>2015-03-17 18:58:34 +0200
commite10ddbdaefe0c74875648bf182e000d0b5e42a82 (patch)
treecdf71839278ddcbc8c75454e11d6d39d2378aff4
parentaf765c345234e920a4c45ba24af156a029304ab9 (diff)
downloadrspamd-e10ddbdaefe0c74875648bf182e000d0b5e42a82.tar.gz
rspamd-e10ddbdaefe0c74875648bf182e000d0b5e42a82.zip
Work around Debian mishandling of systemd socket-activated units
If there is a backward compatibility sysvinit script, then even socket-activated services are started automatically after install/upgrade.
-rw-r--r--debian/postinst9
-rw-r--r--debian/postrm8
-rw-r--r--debian/prerm8
-rwxr-xr-xdebian/rules8
4 files changed, 32 insertions, 1 deletions
diff --git a/debian/postinst b/debian/postinst
index 7d6db2347..6d725a90d 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -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
diff --git a/debian/postrm b/debian/postrm
index 10a84805e..0ab952d46 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -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
index 000000000..94172155b
--- /dev/null
+++ b/debian/prerm
@@ -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#
diff --git a/debian/rules b/debian/rules
index 9eb1014f1..e3959eb57 100755
--- a/debian/rules
+++ b/debian/rules
@@ -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