From b5280963638c96b95d7c5f5ad52cf8b4b521ea8b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 10 Apr 2012 12:48:00 -0400 Subject: [PATCH] dh_installinit: rework upstart handling to comply with new policy proposal; packages will ship both an init script and an upstart job, instead of just an upstart job and a symlink to a compat wrapper. Closes: #577040 --- debian/changelog | 7 ++++++ debian/copyright | 2 +- dh_installinit | 58 ++++++++++++++++-------------------------------- 3 files changed, 27 insertions(+), 40 deletions(-) diff --git a/debian/changelog b/debian/changelog index a2e876b..785ad87 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,17 @@ debhelper (9.20120323) UNRELEASED; urgency=low + [ Joey Hess ] * Fix a typo. Closes: #665891 * Conflict with too old automake for AM_UPDATE_INFO_DIR=no. Closes: #666901 * dh_md5sums: Don't skip DEBIAN directories other than the control files one. Closes: #668276 + [ Steve Langasek ] + * dh_installinit: rework upstart handling to comply with new policy + proposal; packages will ship both an init script and an upstart job, + instead of just an upstart job and a symlink to a compat wrapper. + Closes: #577040 + -- Joey Hess Mon, 26 Mar 2012 17:18:58 -0400 debhelper (9.20120322) unstable; urgency=low diff --git a/debian/copyright b/debian/copyright index ceb743f..4ec9761 100644 --- a/debian/copyright +++ b/debian/copyright @@ -57,7 +57,7 @@ License: GPL-2+ Files: dh_installinit Copyright: 1997-2008 Joey Hess - 2009 Canonical Ltd. + 2009,2011 Canonical Ltd. License: GPL-3+ Files: dh_installgsettings diff --git a/dh_installinit b/dh_installinit index d08798a..4daff14 100755 --- a/dh_installinit +++ b/dh_installinit @@ -2,7 +2,7 @@ =head1 NAME -dh_installinit - install upstart jobs or init scripts into package build directories +dh_installinit - install upstart jobs and/or init scripts into package build directories =cut @@ -16,9 +16,8 @@ B [S>] [B<--name=>I] [B<-n>] [B<-R>] =head1 DESCRIPTION B is a debhelper program that is responsible for installing -upstart job files or init scripts with associated defaults files into package -build directories, and in the former case providing compatibility handling -for non-upstart systems. +upstart job files and init scripts with associated defaults files into +package build directories. It also automatically generates the F and F and F commands needed to set up the symlinks in F to start and stop the init @@ -35,8 +34,8 @@ build directory. =item debian/I.init -Otherwise, if this exists, it is installed -into etc/init.d/I in the package build directory. +If this exists, it is installed into etc/init.d/I in the package +build directory. =item debian/I.default @@ -60,11 +59,6 @@ script, default files, or upstart job. May be useful if the init script or upstart job is shipped and/or installed by upstream in a way that doesn't make it easy to let B find it. -If no upstart job file is installed in the target directory when -B is called, this program will assume that an -init script is being installed and not provide the compatibility symlinks -or upstart dependencies. - =item B<-R>, B<--restart-after-upgrade> Do not stop the init script until after the package upgrade has been @@ -88,7 +82,7 @@ Only call B. Useful for rcS scripts. =item B<-d>, B<--remove-d> Remove trailing B from the name of the package, and use the result for the -filename the upstart job file is installed as in F , or for the +filename the upstart job file is installed as in F , and for the filename the init script is installed as in etc/init.d and the default file is installed as in F . This may be useful for daemons with names ending in B. (Note: this takes precedence over the B<--init-script> parameter @@ -103,7 +97,7 @@ passed to L. =item B<--name=>I -Install the upstart job file or the init script (and default file) using the +Install the upstart job file and init script (and default file) using the filename I instead of the default filename, which is the package name. When this parameter is used, B looks for and installs files named F, F and @@ -120,7 +114,7 @@ F and if so will install it as the init script in preference to the files it normally installs. This parameter is deprecated, use the B<--name> parameter instead. This -parameter will be ignored completely for upstart jobs. +parameter is incompatible with the use of upstart jobs. =item B<--error-handler=>I @@ -175,31 +169,15 @@ foreach my $package (@{$dh{DOPACKAGES}}) { else { $script=$package; } - + my $job=pkgfile($package,"upstart"); - my $init=''; - if ($job ne '' || ($dh{ONLYSCRIPTS} && -e "$tmp/etc/init/$jobfile.conf")) { - if (! $dh{ONLYSCRIPTS}) { - if (! -d "$tmp/etc/init") { - doit("install","-d","$tmp/etc/init"); - } - - doit("install","-p","-m644",$job,"$tmp/etc/init/$jobfile.conf"); + if ($job ne '' && ! $dh{ONLYSCRIPTS}) { + if (! -d "$tmp/etc/init") { + doit("install","-d","$tmp/etc/init"); } - # ensures that our /etc/init.d/ symlink points to a valid - # implementation - addsubstvar($package, "misc:Depends", "upstart-job"); - - if (! -d "$tmp/etc/init.d") { - doit("install","-d","$tmp/etc/init.d"); - } - doit("ln","-sf","/lib/init/upstart-job","$tmp/etc/init.d/$jobfile"); - } - else { - $init=pkgfile($package,$script) || pkgfile($package,"init") || - pkgfile($package,"init.d"); + doit("install","-p","-m644",$job,"$tmp/etc/init/$jobfile.conf"); } my $default=pkgfile($package,'default'); @@ -210,6 +188,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) { doit("install","-p","-m644",$default,"$tmp/etc/default/$script"); } + my $init=pkgfile($package,$script) || pkgfile($package,"init") || + pkgfile($package,"init.d"); if ($init ne '' && ! $dh{ONLYSCRIPTS}) { if (! -d "$tmp/etc/init.d") { doit("install","-d","$tmp/etc/init.d"); @@ -218,11 +198,11 @@ foreach my $package (@{$dh{DOPACKAGES}}) { doit("install","-p","-m755",$init,"$tmp/etc/init.d/$script"); } - if ($job ne '' || $init ne '' || $dh{ONLYSCRIPTS}) { - if (-e "$tmp/etc/init/$jobfile.conf") { - $script=$jobfile; - } + if ($dh{INIT_SCRIPT} && $job ne '' && $init ne '') { + error("Can't use --init-script with an upstart job"); + } + if ($job ne '' || $init ne '' || $dh{ONLYSCRIPTS}) { # 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". -- 2.39.2