summaryrefslogtreecommitdiff
path: root/autoscripts
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-07-07 13:43:42 +0200
committerNiels Thykier <niels@thykier.net>2016-07-09 08:15:52 +0000
commit27d80816bae4756497fc673652d3636799f08c2f (patch)
tree3d6220a20b58d74e8864216eb8755cbce7f41083 /autoscripts
parentee9f5d721fbfae3cee9d40c9858310393c10ab49 (diff)
downloaddebhelper-27d80816bae4756497fc673652d3636799f08c2f.tar.gz
Merge dh-systemd into debhelper proper
Diffstat (limited to 'autoscripts')
-rw-r--r--autoscripts/postinst-systemd-dont-enable13
-rw-r--r--autoscripts/postinst-systemd-enable13
-rw-r--r--autoscripts/postinst-systemd-restart9
-rw-r--r--autoscripts/postinst-systemd-start4
-rw-r--r--autoscripts/postrm-systemd12
-rw-r--r--autoscripts/postrm-systemd-reload-only3
-rw-r--r--autoscripts/prerm-systemd3
-rw-r--r--autoscripts/prerm-systemd-restart3
8 files changed, 60 insertions, 0 deletions
diff --git a/autoscripts/postinst-systemd-dont-enable b/autoscripts/postinst-systemd-dont-enable
new file mode 100644
index 00000000..2dd86a1f
--- /dev/null
+++ b/autoscripts/postinst-systemd-dont-enable
@@ -0,0 +1,13 @@
+if deb-systemd-helper debian-installed #UNITFILE#; then
+ # This will only remove masks created by d-s-h on package removal.
+ deb-systemd-helper unmask #UNITFILE# >/dev/null || true
+
+ if deb-systemd-helper --quiet 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
diff --git a/autoscripts/postinst-systemd-enable b/autoscripts/postinst-systemd-enable
new file mode 100644
index 00000000..b9030380
--- /dev/null
+++ b/autoscripts/postinst-systemd-enable
@@ -0,0 +1,13 @@
+# This will only remove masks created by d-s-h on package removal.
+deb-systemd-helper unmask #UNITFILE# >/dev/null || true
+
+# was-enabled defaults to true, so new installations run enable.
+if deb-systemd-helper --quiet was-enabled #UNITFILE#; then
+ # Enables the unit on first installation, creates new
+ # symlinks on upgrades if the unit file has changed.
+ deb-systemd-helper 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 update-state #UNITFILE# >/dev/null || true
+fi
diff --git a/autoscripts/postinst-systemd-restart b/autoscripts/postinst-systemd-restart
new file mode 100644
index 00000000..696fbb07
--- /dev/null
+++ b/autoscripts/postinst-systemd-restart
@@ -0,0 +1,9 @@
+if [ -d /run/systemd/system ]; then
+ systemctl --system daemon-reload >/dev/null || true
+ if [ -n "$2" ]; then
+ _dh_action=try-restart
+ else
+ _dh_action=start
+ fi
+ deb-systemd-invoke $_dh_action #UNITFILES# >/dev/null || true
+fi
diff --git a/autoscripts/postinst-systemd-start b/autoscripts/postinst-systemd-start
new file mode 100644
index 00000000..8134a040
--- /dev/null
+++ b/autoscripts/postinst-systemd-start
@@ -0,0 +1,4 @@
+if [ -d /run/systemd/system ]; then
+ systemctl --system daemon-reload >/dev/null || true
+ deb-systemd-invoke start #UNITFILES# >/dev/null || true
+fi
diff --git a/autoscripts/postrm-systemd b/autoscripts/postrm-systemd
new file mode 100644
index 00000000..22725ce1
--- /dev/null
+++ b/autoscripts/postrm-systemd
@@ -0,0 +1,12 @@
+if [ "$1" = "remove" ]; then
+ if [ -x "/usr/bin/deb-systemd-helper" ]; then
+ deb-systemd-helper mask #UNITFILES# >/dev/null
+ fi
+fi
+
+if [ "$1" = "purge" ]; then
+ if [ -x "/usr/bin/deb-systemd-helper" ]; then
+ deb-systemd-helper purge #UNITFILES# >/dev/null
+ deb-systemd-helper unmask #UNITFILES# >/dev/null
+ fi
+fi
diff --git a/autoscripts/postrm-systemd-reload-only b/autoscripts/postrm-systemd-reload-only
new file mode 100644
index 00000000..91cd9e8d
--- /dev/null
+++ b/autoscripts/postrm-systemd-reload-only
@@ -0,0 +1,3 @@
+if [ -d /run/systemd/system ]; then
+ systemctl --system daemon-reload >/dev/null || true
+fi
diff --git a/autoscripts/prerm-systemd b/autoscripts/prerm-systemd
new file mode 100644
index 00000000..6cc72423
--- /dev/null
+++ b/autoscripts/prerm-systemd
@@ -0,0 +1,3 @@
+if [ -d /run/systemd/system ]; then
+ deb-systemd-invoke stop #UNITFILES# >/dev/null
+fi
diff --git a/autoscripts/prerm-systemd-restart b/autoscripts/prerm-systemd-restart
new file mode 100644
index 00000000..51abb0b0
--- /dev/null
+++ b/autoscripts/prerm-systemd-restart
@@ -0,0 +1,3 @@
+if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
+ deb-systemd-invoke stop #UNITFILES# >/dev/null
+fi