Browse Source

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.
tags/0.9.0
Mikhail Gusarov 9 years ago
parent
commit
e10ddbdaef
4 changed files with 32 additions and 1 deletions
  1. 9
    0
      debian/postinst
  2. 8
    0
      debian/postrm
  3. 8
    0
      debian/prerm
  4. 7
    1
      debian/rules

+ 9
- 0
debian/postinst View 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

+ 8
- 0
debian/postrm View 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

+ 8
- 0
debian/prerm View File

@@ -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#

+ 7
- 1
debian/rules View File

@@ -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

Loading…
Cancel
Save