diff options
-rw-r--r-- | autoscripts/postinst-systemd-restart | 2 | ||||
-rw-r--r-- | autoscripts/postinst-systemd-restartnostart | 2 | ||||
-rwxr-xr-x | dh_installsystemd | 21 |
3 files changed, 16 insertions, 9 deletions
diff --git a/autoscripts/postinst-systemd-restart b/autoscripts/postinst-systemd-restart index 048e9685..8155bc05 100644 --- a/autoscripts/postinst-systemd-restart +++ b/autoscripts/postinst-systemd-restart @@ -2,7 +2,7 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then - _dh_action=restart + _dh_action=#RESTART_ACTION# else _dh_action=start fi diff --git a/autoscripts/postinst-systemd-restartnostart b/autoscripts/postinst-systemd-restartnostart index 8ac28fb3..d3f199cf 100644 --- a/autoscripts/postinst-systemd-restartnostart +++ b/autoscripts/postinst-systemd-restartnostart @@ -2,7 +2,7 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon 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 + deb-systemd-invoke #RESTART_ACTION# #UNITFILES# >/dev/null || true fi fi fi diff --git a/dh_installsystemd b/dh_installsystemd index d1ba5708..48a0e787 100755 --- a/dh_installsystemd +++ b/dh_installsystemd @@ -389,27 +389,34 @@ foreach my $package (@{$dh{DOPACKAGES}}) { } if (@start_units) { - my $units = { 'UNITFILES' => join(' ', @start_units) }; + my $replace = { 'UNITFILES' => join(' ', @start_units) }; if ($dh{RESTART_AFTER_UPGRADE}) { - my $snippet = $dh{NO_START} ? 'postinst-systemd-restartnostart' : 'postinst-systemd-restart'; - autoscript($package, 'postinst', $snippet, $units, \%options); + my $snippet; + if ($dh{NO_START}) { + $snippet = 'postinst-systemd-restartnostart'; + $replace->{RESTART_ACTION} = 'try-restart'; + } else { + $snippet = 'postinst-systemd-restart'; + $replace->{RESTART_ACTION} = 'restart'; + } + autoscript($package, 'postinst', $snippet, $replace, \%options); } elsif (!$dh{NO_START}) { # (stop|start) service (before|after) upgrade - autoscript($package, 'postinst', 'postinst-systemd-start', $units, \%options); + autoscript($package, 'postinst', 'postinst-systemd-start', $replace, \%options); } if ($dh{R_FLAG} || $dh{RESTART_AFTER_UPGRADE}) { # stop service only on remove - autoscript($package, 'prerm', 'prerm-systemd-restart', $units, \%options); + autoscript($package, 'prerm', 'prerm-systemd-restart', $replace, \%options); } elsif (!$dh{NO_START}) { # always stop service - autoscript($package, 'prerm', 'prerm-systemd', $units, \%options); + autoscript($package, 'prerm', 'prerm-systemd', $replace, \%options); } # Run this with "default" order so it is always after other # service related autosnippets. - autoscript($package, 'postrm', 'postrm-systemd-reload-only', $units); + autoscript($package, 'postrm', 'postrm-systemd-reload-only', $replace); } } |