summaryrefslogtreecommitdiff
path: root/autoscripts/postinst-systemd-dont-enable
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-07-24 20:09:57 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-07-24 20:12:43 +0200
commit23b7a3dd33cb9ba5249c571572f7b5abda49104e (patch)
treed77364f0cd2c47bb727e718b958826f3e478f58b /autoscripts/postinst-systemd-dont-enable
parent237da59d8db54048cb4c2aee5ae09abfeeebbfe8 (diff)
downloadinit-system-helpers-23b7a3dd33cb9ba5249c571572f7b5abda49104e.tar.gz
dh_systemd_enable: deal with changes in the [Install] section
autoscripts/postinst-systemd-dont-enable now uses update-state instead of enable/disable which fixes accidental re-disabling of services. Both autoscripts call enable to create new symlinks, if necessary. Both autoscripts call update-state in case the service is not enabled in order to update the state file so that all service files will be removed on purge. See also http://bugs.debian.org/#717603
Diffstat (limited to 'autoscripts/postinst-systemd-dont-enable')
-rw-r--r--autoscripts/postinst-systemd-dont-enable15
1 files changed, 9 insertions, 6 deletions
diff --git a/autoscripts/postinst-systemd-dont-enable b/autoscripts/postinst-systemd-dont-enable
index 7641052..2bf34ec 100644
--- a/autoscripts/postinst-systemd-dont-enable
+++ b/autoscripts/postinst-systemd-dont-enable
@@ -1,7 +1,10 @@
-if [ -x "/usr/bin/deb-systemd-helper" ]; then
- # This might seem weird at first glance, but the seemingly useless
- # enable/disable is necessary to make deb-systemd-helper create its
- # state file to properly disable the unit files at purge time.
- deb-systemd-helper --quiet enable #UNITFILES# >/dev/null || true
- deb-systemd-helper --quiet disable #UNITFILES# >/dev/null || true
+if deb-systemd-helper debian-is-installed #UNITFILE#; then
+ if deb-systemd-helper was-enabled #UNITFILE#; then
+ # Create new symlinks, if any.
+ deb-systemd-helper enable #UNITFILE# >/dev/null || true
+ fi
fi
+
+# Update the statefile to add new symlinks (if any), which need to be cleaned
+# up on purge. Also remove old symlinks.
+deb-systemd-helper update-state #UNITFILE# >/dev/null || true