summaryrefslogtreecommitdiff
path: root/autoscripts
diff options
context:
space:
mode:
Diffstat (limited to 'autoscripts')
-rw-r--r--autoscripts/postinst-systemd-user-dont-enable15
-rw-r--r--autoscripts/postinst-systemd-user-enable15
-rw-r--r--autoscripts/postrm-systemd-user12
3 files changed, 42 insertions, 0 deletions
diff --git a/autoscripts/postinst-systemd-user-dont-enable b/autoscripts/postinst-systemd-user-dont-enable
new file mode 100644
index 00000000..0837257f
--- /dev/null
+++ b/autoscripts/postinst-systemd-user-dont-enable
@@ -0,0 +1,15 @@
+if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
+ if deb-systemd-helper --user debian-installed #UNITFILE# ; then
+ # This will only remove masks created by d-s-h on package removal.
+ deb-systemd-helper --user unmask #UNITFILE# >/dev/null || true
+
+ if deb-systemd-helper --quiet --user was-enabled #UNITFILE# ; then
+ # Create new symlinks, if any.
+ deb-systemd-helper --user 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 --user update-state #UNITFILE# >/dev/null || true
+fi
diff --git a/autoscripts/postinst-systemd-user-enable b/autoscripts/postinst-systemd-user-enable
new file mode 100644
index 00000000..b16f61fb
--- /dev/null
+++ b/autoscripts/postinst-systemd-user-enable
@@ -0,0 +1,15 @@
+if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
+ # This will only remove masks created by d-s-h on package removal.
+ deb-systemd-helper --user unmask #UNITFILE# >/dev/null || true
+
+ # was-enabled defaults to true, so new installations run enable.
+ if deb-systemd-helper --quiet --user was-enabled #UNITFILE# ; then
+ # Enables the unit on first installation, creates new
+ # symlinks on upgrades if the unit file has changed.
+ deb-systemd-helper --user enable #UNITFILE# >/dev/null || true
+ else
+ # Update the statefile to add new symlinks (if any), which need to be
+ # cleaned up on purge. Also remove old symlinks.
+ deb-systemd-helper --user update-state #UNITFILE# >/dev/null || true
+ fi
+fi
diff --git a/autoscripts/postrm-systemd-user b/autoscripts/postrm-systemd-user
new file mode 100644
index 00000000..bf48d1a3
--- /dev/null
+++ b/autoscripts/postrm-systemd-user
@@ -0,0 +1,12 @@
+if [ "$1" = "remove" ]; then
+ if [ -x "/usr/bin/deb-systemd-helper" ] ; then
+ deb-systemd-helper --user mask #UNITFILES# >/dev/null || true
+ fi
+fi
+
+if [ "$1" = "purge" ]; then
+ if [ -x "/usr/bin/deb-systemd-helper" ] ; then
+ deb-systemd-helper --user purge #UNITFILES# >/dev/null || true
+ deb-systemd-helper --user unmask #UNITFILES# >/dev/null || true
+ fi
+fi