[Pkg-sysvinit-devel] Request for dh_installinit and/or update-rc.d

Kel Modderman kel at otaku42.de
Sat Apr 30 11:59:14 UTC 2011


On Thu, 28 Apr 2011 08:08:09 AM Marc MERLIN wrote:
> On Tue, Mar 22, 2011 at 08:19:15AM -0700, Marc MERLIN wrote:
> > Hi,
> > 
> > I work on debian packages that need to have all their files as part of
> > the package.
> > 
> > As a result, the normal dh_installinit that creates a postinst that runs
> > update-rc.d is no good for me since the symlink files aren't part of the
> > package.
> > 
> > It would be fantastic if dh_installinit could grow an option that tells
> > it to make the rcX.d symlinks at package build time.
> > 
> > However for now I figured I would just use update-rc.d to make my own
> > symlinks in the foo/debian/packagename/ directory at build time.
> > But then I realized that it has
> > my $initd = "/etc/init.d";
> > my $etcd  = "/etc/rc";
> > hardcoded in it, with no override capability.
> > 
> > It would be great if update-rc.d could take a command line option and/or
> > an env variable to allow replacing those 2 variables, or at least the
> > '/etc' prefix (which would be good enough for me here).
> > 
> > Joey (hi :), I'm not sure if my feature request for dh_installinit is
> > reasonable within your vision or would even happen.
> > 
> > Sysvinit maintainers, separately, would you consider adding a patch like
> > the one below?
> 
> Hi Guys,
> 
> we now use the patch below at google for our internal packages due to our
> requirement that all files on the filesystem need to be part of a package
> (i.e. update-rc.d dropping files in postinstall is no good).
> 
> I didn't really hear back last time :)
> Would Joey either be happy with supporting dh_installinit creating symlinks
> at package build time, or Sysvinit maintainers, would you be ok with my
> patch below?

I won't be applying the update-rc.d patch myself, it adds an extra path of 
code we will likely never need in Debian. I do not understand why such a 
restriction your debian package development process exists.

Proposed a similar patch a few years ago and it was veto'd. It used a command 
line switch instead of environment variable for selection of init.d dir and 
wasn't concerned about creating the rc.d directories.

Thanks, Kel.

> 
> Thanks,
> Marc
> 
> > Thanks,
> > Marc
> > 
> > --- /usr/sbin/update-rc.d	2010-09-24 11:16:41.000000000 -0700
> > +++ /tmp/update-rc.d	2011-03-22 08:14:35.152011532 -0700
> > @@ -6,8 +6,18 @@
> > 
> >  use strict;
> >  use warnings;
> > 
> > -my $initd = "/etc/init.d";
> > -my $etcd  = "/etc/rc";
> > +my $prefix ='/etc';
> > +if ($ENV{'RCD_PREFIX'})
> > +{
> > +    $prefix = $ENV{'RCD_PREFIX'};
> > +    foreach my $dir (qw(rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc5.d rc6.d
> > rcS.d)) +    {
> > +	mkdir ("$prefix/$dir", 0755);
> > +    }
> > +}
> > +
> > +my $initd = "$prefix/init.d";
> > +my $etcd  = "$prefix/rc";
> > 
> >  my $notreally = 0;
> >  
> >  # Print usage message and die.
> > 
> > @@ -30,7 +40,7 @@
> > 
> >  # Dependency based boot sequencing is the default, but upgraded
> >  # systems might keep the legacy ordering until the sysadm choose to
> >  # migrate to the new ordering method.
> > 
> > -if ( ! -f "/etc/init.d/.legacy-bootordering" ) {
> > +if ( ! -f "$initd/.legacy-bootordering" and $prefix eq '/etc') {
> > 
> >      info("using dependency based boot sequencing");
> >      exit insserv_updatercd(@ARGV);
> >  
> >  }
> > 
> > @@ -52,7 +62,7 @@
> > 
> >      my ($script, @arguments) = @_;
> >      my $archive = "/var/lib/update-rc.d";
> > 
> > -    return if $notreally;
> > +    return if ($notreally or $prefix ne "/etc");
> > 
> >      open(FILE, ">", "$archive/${script}.new") || die;
> >      print FILE join(" ","update-rc.d", at arguments), "\n";
> > 
> > @@ -376,7 +386,7 @@
> > 
> >      $scriptname = shift @args;
> >      $action = shift @args;
> >      if ("remove" eq $action) {
> > 
> > -        if ( -f "/etc/init.d/$scriptname" ) {
> > +        if ( -f "$initd/$scriptname" ) {
> > 
> >              my $rc = system "insserv", @opts, "-r", $scriptname;
> >              if (0 == $rc && !$notreally) {
> >              
> >                  save_last_action($scriptname, @orig_argv);
> > 
> > @@ -398,14 +408,14 @@
> > 
> >          # with Default-Start/Default-Stop values of LSB comment.
> >          cmp_args_with_defaults($scriptname, $action, @args);
> > 
> > -        if ( -f "/etc/init.d/$scriptname" ) {
> > +        if ( -f "$initd/$scriptname" ) {
> > 
> >              my $rc = system "insserv", @opts, $scriptname;
> >              if (0 == $rc && !$notreally) {
> >              
> >                  save_last_action($scriptname, @orig_argv);
> >              
> >              }
> >              exit $rc;
> >          
> >          } else {
> > 
> > -            error("initscript does not exist: /etc/init.d/$scriptname");
> > +            error("initscript does not exist: $initd/$scriptname");
> > 
> >          }
> >      
> >      } elsif ("disable" eq $action || "enable" eq $action) {
> >      
> >          insserv_toggle($notreally, $action, $scriptname, @args);
> > 
> > @@ -451,7 +461,7 @@
> > 
> >  sub lsb_header_for_script {
> >  
> >      my $name = shift;
> > 
> > -    foreach my $file ("/etc/insserv/overrides/$name",
> > "/etc/init.d/$name", +    foreach my $file
> > ("/etc/insserv/overrides/$name", "$initd/$name",
> > 
> >                        "/usr/share/insserv/overrides/$name") {
> >          
> >          return $file if -s $file;
> >      
> >      }
> > 
> > @@ -464,7 +474,7 @@
> > 
> >      my ($lsb_start_ref, $lsb_stop_ref, $arg_str, $lsb_str);
> >      my (@arg_start_lvls, @arg_stop_lvls, @lsb_start_lvls,
> >      @lsb_stop_lvls);
> > 
> > -    ($lsb_start_ref, $lsb_stop_ref) =
> > parse_def_start_stop("/etc/init.d/$name"); +    ($lsb_start_ref,
> > $lsb_stop_ref) = parse_def_start_stop("$initd/$name");
> > 
> >      @lsb_start_lvls = @$lsb_start_ref;
> >      @lsb_stop_lvls  = @$lsb_stop_ref;
> >      return if (!@lsb_start_lvls and !@lsb_stop_lvls);



More information about the Pkg-sysvinit-devel mailing list