[debhelper-devel] [debhelper] 02/02: dh_installinit: Add a --no-enable parameter

Niels Thykier nthykier at moszumanska.debian.org
Sun Dec 31 19:04:42 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 dc13d672b97894ccffc150b263e5c3b88da0c183
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Dec 31 19:03:08 2017 +0000

    dh_installinit: Add a --no-enable parameter
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog |  6 ++++++
 dh_installinit   | 35 ++++++++++++++++++++++++++++-------
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ba293ff..550d43a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,12 @@ debhelper (11.1) UNRELEASED; urgency=medium
   * dh_compress: In compat 12, stop compressing any thing in
     /usr/share/doc/$pkg/examples.  Thanks to Piotr Ożarowski for
     the suggestion.  (Closes: #593382)
+  * dh_installinit: Support a new --no-enable parameter to setup the
+    init script with the "defaults-disabled" and add the proper
+    versioned dependency on "init-system-helpers (>= 1.51)", which is
+    the first (functional) version with support for
+    "defaults-disabled".  Thanks to Laurent Bigonville for the
+    report and Evgeni Golov for filing #857452.  (Closes: #709384)
 
  -- Niels Thykier <niels at thykier.net>  Sun, 17 Dec 2017 07:59:18 +0000
 
diff --git a/dh_installinit b/dh_installinit
index 0bcbe49..53deff1 100755
--- a/dh_installinit
+++ b/dh_installinit
@@ -134,6 +134,20 @@ variant was introduced in debhelper 10.2 (included in Debian stretch).
 Do not start the init script on install or upgrade, or stop it on removal.
 Only call B<update-rc.d>. Useful for rcS scripts.
 
+=item B<--no-enable>
+
+Disable the init script on purge, but do not enable them on install.
+This implies a versioned dependency on B<init-system-helpers (>=
+1.51)> as it is the first (functional) version that supports
+B<<update-rc.d <script> defaults-disabled>>.
+
+B<Note> that this option does not affect whether the services are
+started.  Please remember to also use B<--no-start> if the service
+should not be started.
+
+Cannot be combined with B<-u>I<params>,
+B<--update-rcd-params=>I<params>, or B<--> I<params>.
+
 =item B<-d>, B<--remove-d>
 
 Remove trailing B<d> from the name of the package, and use the result for the
@@ -147,8 +161,11 @@ described below.)
 
 =item B<--> I<params>
 
-Pass I<params> to L<update-rc.d(8)>. If not specified, B<defaults> will be
-passed to L<update-rc.d(8)>.
+Pass I<params> to L<update-rc.d(8)>. If not specified, B<defaults> (or
+B<defaults-disabled> with B<--no-enable>) will be passed to
+L<update-rc.d(8)>.
+
+Cannot be combined with B<--no-enable>.
 
 =item B<--name=>I<name>
 
@@ -203,6 +220,7 @@ init(options => {
 	"init-script=s" => \$dh{INIT_SCRIPT},
 	"update-rcd-params=s", => \$dh{U_PARAMS},
 	"remove-d" => \$dh{D_FLAG},
+	"no-enable" => \$dh{NO_ENABLE},
 });
 
 # PROMISE: DH NOOP WITHOUT service tmpfile default upstart init init.d tmp(usr/lib/tmpfiles.d) tmp(etc/tmpfiles.d)
@@ -321,13 +339,16 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		# This is set by the -u "foo" command line switch, it's
 		# the parameters to pass to update-rc.d. If not set,
 		# we have to say "defaults".
-		my $params='';
-		if (defined($dh{U_PARAMS})) {
+		my $params = 'defaults';
+		if ($dh{NO_ENABLE}) {
+			$params = 'defaults-disabled';
+			addsubstvar($package, "misc:Depends", "init-system-helpers (>= 1.51)");
+		}
+
+		if (defined($dh{U_PARAMS}) and @{$dh{U_PARAMS}}) {
+			error("--no-enable and -- params/-u/--update-rcd-params/ are mutually exclusive") if $dh{NO_ENABLE};
 			$params=join(' ',@{$dh{U_PARAMS}});
 		}	
-		if ($params eq '') {
-			$params="defaults";
-		}
 		
 		if (! $dh{NOSCRIPTS}) {
 			if (! $dh{NO_START}) {

-- 
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