summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@debian.org>2016-10-22 20:49:12 -0300
committerNiels Thykier <niels@thykier.net>2016-12-15 07:17:59 +0000
commit43c01e83a51bcfc31480f0ba955dcb25c4181eae (patch)
tree4ef538a03115756b2c799677eccc086476cdacea
parentad4f021fd47d29db2216e02eb033788687ee8b63 (diff)
downloaddebhelper-43c01e83a51bcfc31480f0ba955dcb25c4181eae.tar.gz
systemd_start: do not start when --no-start and --restart-after-upgrade are combined
But do restart on upgrades Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--autoscripts/postinst-systemd-restartnostart6
-rwxr-xr-xdh_systemd_start3
2 files changed, 8 insertions, 1 deletions
diff --git a/autoscripts/postinst-systemd-restartnostart b/autoscripts/postinst-systemd-restartnostart
new file mode 100644
index 00000000..eb52e273
--- /dev/null
+++ b/autoscripts/postinst-systemd-restartnostart
@@ -0,0 +1,6 @@
+if [ -d /run/systemd/system ]; then
+ systemctl --system daemon-reload >/dev/null || true
+ if [ -n "$2" ]; then
+ deb-systemd-invoke try-restart #UNITFILES# >/dev/null || true
+ fi
+fi
diff --git a/dh_systemd_start b/dh_systemd_start
index 940fc80e..46c14a7d 100755
--- a/dh_systemd_start
+++ b/dh_systemd_start
@@ -225,7 +225,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
};
if ($dh{RESTART_AFTER_UPGRADE}) {
- $sd_autoscript->("postinst", "postinst-systemd-restart");
+ my $snippet = "postinst-systemd-restart" . ($dh{NO_START} ? "nostart" : "");
+ $sd_autoscript->("postinst", $snippet);
} elsif (!$dh{NO_START}) {
# We need to stop/start before/after the upgrade.
$sd_autoscript->("postinst", "postinst-systemd-start");