[debhelper-devel] [debhelper] 03/03: dh_installinit: Do most autoscripts substs without a shell

Niels Thykier nthykier at moszumanska.debian.org
Mon Jan 1 08:39:23 UTC 2018


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 0396db5260d875f434333b48b2c963576b1f6cf1
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Jan 1 08:37:11 2018 +0000

    dh_installinit: Do most autoscripts substs without a shell
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog |  2 ++
 dh_installinit   | 14 ++++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1618c90..17806f8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,6 +43,8 @@ debhelper (11.1) UNRELEASED; urgency=medium
     systemd related tools if we do it in other scripts for the same
     command.  Thanks to Laurent Bigonville for the report.
     (Closes: #761272)
+  * dh_installinit: Perform the autoscript substitutions without
+    needing a shell.
 
  -- Niels Thykier <niels at thykier.net>  Sun, 17 Dec 2017 07:59:18 +0000
 
diff --git a/dh_installinit b/dh_installinit
index 53deff1..5410769 100755
--- a/dh_installinit
+++ b/dh_installinit
@@ -330,6 +330,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			no_chdir => 1,
 		}, $tmp);
 		if (@tmpfiles > 0) {
+			# Not migrated to hashref based autoscripts.  This will
+			# happen as people migrate to dh_installsystemd.
 			autoscript($package,"postinst", "postinst-init-tmpfiles",
 				"s,#TMPFILES#," . join(" ", sort @tmpfiles).",g");
 		}
@@ -356,34 +358,34 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 					# update-rc.d, and restart (or
 					# start if new install) script
 					autoscript($package,"postinst", "postinst-init-restart",
-						"s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/g;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/g");
+						{ 'SCRIPT' => $script, 'INITPARMS' => $params, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} });
 				}
 				else {
 					# update-rc.d, and start script
 					autoscript($package,"postinst", "postinst-init",
-						"s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/g;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/g");
+						{ 'SCRIPT' => $script, 'INITPARMS' => $params, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} });
 				}
 			
 				if ($dh{R_FLAG} || $dh{RESTART_AFTER_UPGRADE}) {
 					# stops script only on remove
 					autoscript($package,"prerm","prerm-init-norestart",
-						"s/#SCRIPT#/$script/g;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/g");
+						{ 'SCRIPT' => $script, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} });
 				}
 				else {
 					# always stops script
 					autoscript($package,"prerm","prerm-init",
-						"s/#SCRIPT#/$script/g;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/g");
+						{ 'SCRIPT' => $script, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} });
 				}
 			}
 			else {
 				# just update-rc.d
 				autoscript($package,"postinst", "postinst-init-nostart",
-					"s/#SCRIPT#/$script/g;s/#INITPARMS#/$params/g;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/g");
+					{ 'SCRIPT' => $script, 'INITPARMS' => $params, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} });
 			}
 
 			# removes rc.d links
 			autoscript($package,"postrm","postrm-init",
-				"s/#SCRIPT#/$script/g;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/g");
+				{ 'SCRIPT' => $script, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} });
 		}
 	}
 }

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