[Pkg-sysvinit-devel] Future of update-rc.d in wheezy+1

Roger Leigh rleigh at codelibre.net
Sun Jul 1 23:16:31 UTC 2012


On Fri, Jun 29, 2012 at 10:53:03PM +0100, Roger Leigh wrote:
> On Fri, Jun 29, 2012 at 08:27:22PM +0100, Roger Leigh wrote:
> > The following patch implements this behaviour.  While the insserv
> > parsing logic has been tested, it's not been tested for upgrades
> > or whether the whole script works correctly.
> > 
> > - it needs a Depends on insserv (>= $version_with_-s)
> >   ==> this needs your feedback so it can be uploaded.
> > - the preinst could be simplified to just use
> >     update-rc.d "$script" -f defaults
> >   if this is sufficient to update the sequence numbers in the
> >   configuration.  This probably needs running in the postinst TBH.
> > - this just replaces the defaults and user-provided start and stop
> >   arguments with those provided by insserv.  Other than that, there
> >   are no changes to anything else.
> > - You might need to retain support for the old-style logic so that
> >   if other scripts call update-rc.d in the gap between unpacking and
> >   running the postinst, it won't fail.  Just back out the deletions
> >   and run those blocks only if insserv didn't run or didn't find any
> >   matches, which are a trivial addition to the script.
> > 
> > While this patch is just a proof a concept, this should be pretty much
> > all you need.  It just needs checking and testing by someone with
> > file-rc expertise.  If this could be done in the very near future,
> > then that would be great.
> 
> I've attached an updated patch.

Another patch attached.  This one is somewhat more comprehensive.

- insserv support is "optional".  If insserv is not present, it will
  fall back to using static sequence numbers.  This will provide
  backward compatibility for squeeze upgrades.  For new installations
  from wheezy however, it will generate runlevel.conf using insserv.
  For wheezy+1, you'll likely be required to migrate existing users
  to using insserv, but for now it's optional.
- the output functions have been refactored to include start and
  stop entries on separate lines, because this is the common case
  (due to the sequence numbers for start and stop making no sense to
  be the same, unless it's pure coincidence).
- long obsolete code removed from maintainer scripts.

I've documented most of the user-visible change in NEWS.Debian and
the changelog.

The most important change is this: runlevel.conf is no longer user-
editable, except for adding and removing lines.  When using insserv,
the sequence numbers mean nothing, because they are dynamically
generated from the dependency information.  When you run update-rc.d,
the numbers could potentially change if a script is added or removed
from the middle of the sequence, causing all following scripts to be
renumbered.  This means that only two operations are possible:
1. remove a script.  This is equivalent to "update-rc.d remove"
2. add a script.  This is equivalent to
   "update-rc.d defaults|start|stop" (which are all equivalent from
   the insserv POV--they all just add/update the entries for the
   script according to the LSB dependencies)
So if you want to reorder the scripts, you just edit the LSB header
in the init script, and then run "update-rc.d foo defaults" to
effect the change.  This is a change from the historical behaviour
of file-rc, but it's the logical consequence of having dependency-
based boot: you edit the dependencies, not the script numbers.

Hope this all looks reasonable.  I've tested all the insserv
codepaths, but not the non-insserv case yet.  Testing
file-rc -> sysv-rc migration also needs doing (the change to
not restore the rcS links probably needs reverting).  Anyway,
I hope this is useful as a basis for implementing insserv
support in file-rc; hopefully I've done the bulk of the work and
it just remains to test and tweak, or back out any changes you're
unhappy with.  I'd appreciate any feedback; I can make any further
changes you need if you let me know what you want.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filerc-insserv.patch
Type: text/x-diff
Size: 24173 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-sysvinit-devel/attachments/20120702/1aa032fe/attachment-0001.patch>


More information about the Pkg-sysvinit-devel mailing list