summaryrefslogtreecommitdiff
path: root/autoscripts/postinst-systemd-dont-enable
diff options
context:
space:
mode:
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