Hi,

On 9 October 2016 at 17:26, Felipe Sateler <[email protected]> wrote:
> Control: tags -1 patch
>
> On 23 November 2015 at 11:34, Felipe Sateler <[email protected]> wrote:
>> Package: dh-systemd
>> Version: 1.24
>> Severity: normal
>>
>> Current autoscript has:
>>
>> 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
>>
>>
>> And this does not take into account that --no-start was passed. If it
>> was passed, then try-restart should always be used.
>
> This is more problematic now that restart-on-upgrade is default. The
> following patch fixes the issue:

Please find attached a patch rebased against current master.
Alternatively, you can fetch the branch `restartnorestart` from my
clone[1].

I have re-tested that this gives the desired result:

--restart-after-upgrade + --start => starts and restarts service.
--no-restart-after-upgrade + --start => always starts
--restart-after-upgrade + --no-start => only restarts
-- no-restart-after-upgrade + --no-start => nothing

[1] https://anonscm.debian.org/git/users/fsateler/debhelper.git

Please attach this so that this can be included in stretch.

-- 

Saludos,
Felipe Sateler
From 1afe86c10a378f5fda82c87db243a2ea7e4f8ebe Mon Sep 17 00:00:00 2001
From: Felipe Sateler <[email protected]>
Date: Sat, 22 Oct 2016 20:49:12 -0300
Subject: [PATCH] systemd_start: do not start when --no-start and
 --restart-after-upgrade are combined

But do restart on upgrades
---
 autoscripts/postinst-systemd-restartnostart | 6 ++++++
 dh_systemd_start                            | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 autoscripts/postinst-systemd-restartnostart

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");
-- 
2.11.0

_______________________________________________
Pkg-systemd-maintainers mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers

Reply via email to