summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2018-01-01 08:37:11 +0000
committerNiels Thykier <niels@thykier.net>2018-01-01 08:37:11 +0000
commit0396db5260d875f434333b48b2c963576b1f6cf1 (patch)
tree1b5e58b04ba614803f7e674ee786508ef69d7157
parent8a9db97be30865edc260549fad22ac787cf7293a (diff)
downloaddebhelper-0396db5260d875f434333b48b2c963576b1f6cf1.tar.gz
dh_installinit: Do most autoscripts substs without a shell
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog2
-rwxr-xr-xdh_installinit14
2 files changed, 10 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog
index 1618c905..17806f8c 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@thykier.net> Sun, 17 Dec 2017 07:59:18 +0000
diff --git a/dh_installinit b/dh_installinit
index 53deff12..54107698 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} });
}
}
}