X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh_installinit;h=9c8c1550997ffac3c41c87ba22aa224a8b536b2b;hb=18a0da8092ea9f3dc48bca92b36f592af25a608d;hp=7dc4861eda001bf20a21d83e0f3ead5036a68bdb;hpb=0952ac2e9995da8abe149f3e42b3b8d9d2797112;p=debhelper.git diff --git a/dh_installinit b/dh_installinit index 7dc4861..9c8c155 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 init scripts and/or upstart jobs into package build directories =cut @@ -11,38 +11,37 @@ use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS -B [S>] [B<--name=>I] [B<-n>] [B<-R>] [B<-r>] [B<-d>] [B<-O>] [S I>] +B [S>] [B<--name=>I] [B<-n>] [B<-R>] [B<-r>] [B<-d>] [S I>] =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. +init scripts with associated defaults files, as well as upstart job files +into package build directories. -It also automatically generates the F and F and F commands -needed to set up the symlinks in F and to start and stop the init -scripts. +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 scripts. =head1 FILES =over 4 -=item debian/I.upstart - -If this exists, it is installed into etc/init/I.conf in the package -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 If this exists, it is installed into etc/default/I in the package build directory. +=item debian/I.upstart + +If this exists, it is installed into etc/init/I.conf in the package +build directory. + =back =head1 OPTIONS @@ -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,12 +97,13 @@ passed to L. =item B<--name=>I -Install the upstart job file or the 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 -F, instead of the usual F, -F and F. +Install the init script (and default file) as well as upstart job 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 F +instead of the usual F, F and +F. =item B<--init-script=>I @@ -120,7 +115,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 +170,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 +189,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 +199,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".