diff options
author | Dmitry Bogatov <KAction@debian.org> | 2019-01-17 02:19:27 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2019-07-14 09:55:19 +0000 |
commit | e5fc959e3b97a0d3821aec43c8a4d2aed212dae6 (patch) | |
tree | ffb99fd63490d38181a2d357d4f8e326f2070fb5 | |
parent | bb35df6cc202c5159321722e014bfa0485ab1b7b (diff) | |
download | debhelper-e5fc959e3b97a0d3821aec43c8a4d2aed212dae6.tar.gz |
dh_installinit: --name implies, that init script is present
Previously, `dh_installinit' silently did nothing, when --name option
was passed, but initscript debian/<package>.<name>.init was not found.
In almost all cases, explicit --name means that package maintainer meant
to install init script. If it is not present, it is bug, and must not be
hidden. Now, error is reported in this case. (Closes: #462389)
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r-- | debian/changelog | 5 | ||||
-rwxr-xr-x | dh_installinit | 4 | ||||
-rwxr-xr-x | t/dh_installinit/dh_installinit.t | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index cef4d571..57ffa3c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -50,6 +50,11 @@ debhelper (12.1.2) UNRELEASED; urgency=medium * Buildsystem/cmake: Fix CMAKE_SYSTEM_PROCESSOR for mips64el. (Closes: #926815) + [ Dmitry Bogatov ] + * dh_installinit: Fail with an error if --name is given but + there is no matching init script. Thanks to A Mennucc + for reporting the issue. (Closes: #462389) + [ Translations ] * Update Portuguese translation (Américo Monteiro) (Closes: #886279) diff --git a/dh_installinit b/dh_installinit index fca0a8af..6a490370 100755 --- a/dh_installinit +++ b/dh_installinit @@ -311,6 +311,10 @@ foreach my $package (@{$dh{DOPACKAGES}}) { my $init=pkgfile($package,$scriptsrc) || pkgfile($package,"init") || pkgfile($package,"init.d"); + if (!$init && defined $dh{NAME}) { + error("--name=$dh{NAME} option specified, but init script not found"); + } + if ($init ne '' && ! $dh{ONLYSCRIPTS}) { install_dir("$tmp/etc/init.d"); install_prog($init,"$tmp/etc/init.d/$script"); diff --git a/t/dh_installinit/dh_installinit.t b/t/dh_installinit/dh_installinit.t index b20caa58..afe3821f 100755 --- a/t/dh_installinit/dh_installinit.t +++ b/t/dh_installinit/dh_installinit.t @@ -29,6 +29,7 @@ each_compat_from_and_above_subtest(11, sub { make_path(qw(debian/foo debian/bar debian/baz)); ok(run_dh_tool('dh_installinit')); + ok(! run_dh_tool({'quiet' => 1}, 'dh_installinit', '--name=missing')); ok(! -e "debian/foo/lib/systemd/system/foo.service"); ok(!find_script('foo', 'postinst')); ok(run_dh_tool('dh_clean')); |