[debhelper-devel] [debhelper] 01/01: dh_installsystemd: Avoid invalid scripts when there are no units
Niels Thykier
nthykier at moszumanska.debian.org
Thu Nov 9 21:27:04 UTC 2017
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 86d05e41e4549ca01aa27ebf12f68da84b2d45fd
Author: Niels Thykier <niels at thykier.net>
Date: Thu Nov 9 21:23:44 2017 +0000
dh_installsystemd: Avoid invalid scripts when there are no units
Signed-off-by: Niels Thykier <niels at thykier.net>
---
debian/changelog | 4 ++++
dh_installsystemd | 21 ++++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 6320679..684732a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,10 @@ debhelper (10.10.6) UNRELEASED; urgency=medium
package as long as another on being acted on ships it.
* dh_installsystemd: Optimize the search for files installed in the
tmpfiles.d directories to only look in the tmpfiles.d directories.
+ * dh_installsystemd: Fix a bug where dh_installsystemd would generate
+ invalid maintscript, when there were no units to start or enable.
+ Thanks to Ben Hutchings and Bastian Blank for the bug report.
+ (Closes: #881190)
-- Axel Beckert <abe at debian.org> Fri, 27 Oct 2017 23:48:44 +0200
diff --git a/dh_installsystemd b/dh_installsystemd
index 671fb48..ebe25a3 100755
--- a/dh_installsystemd
+++ b/dh_installsystemd
@@ -349,17 +349,20 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
next if @start_units == 0 && @enable_units == 0;
- for my $unit (sort @enable_units) {
- my $base = q{'} . basename($unit) . q{'};
- if ($dh{NO_ENABLE}) {
- autoscript($package, 'postinst', 'postinst-systemd-dont-enable', { 'UNITFILE' => $base });
- } else {
- autoscript($package, 'postinst', 'postinst-systemd-enable', { 'UNITFILE' => $base });
+ if (@enable_units) {
+ for my $unit (sort @enable_units) {
+ my $base = q{'} . basename($unit) . q{'};
+ if ($dh{NO_ENABLE}) {
+ autoscript($package, 'postinst', 'postinst-systemd-dont-enable', { 'UNITFILE' => $base });
+ } else {
+ autoscript($package, 'postinst', 'postinst-systemd-enable', { 'UNITFILE' => $base });
+ }
}
+ my $enableunitargs = join(' ', sort map { q{'} . basename($_) . q{'} } @enable_units);
+ autoscript($package, 'postrm', 'postrm-systemd', {'UNITFILES' => $enableunitargs });
}
- my $enableunitargs = join(' ', sort map { q{'} . basename($_) . q{'} } @enable_units);
- autoscript($package, 'postrm', 'postrm-systemd', {'UNITFILES' => $enableunitargs });
-
+
+ next if not @start_units;
# The $package and $sed parameters are always the same.
# This wrapper function makes the following logic easier to read.
my $startunitargs = join(' ', sort map { q{'} . basename($_) . q{'} } @start_units);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list