Metainit in Ubuntu?

Scott James Remnant scott at ubuntu.com
Thu Jun 21 11:04:36 UTC 2007


On Thu, 2007-06-21 at 11:26 +0100, Joachim Breitner wrote:

> here at the DebConf 7 in Edinburgh we came up with a somewhat neat idea:
> Observing that a lot of packages ship init scripts, and noting that most
> of these scripts are both not very well cared for (just copy’n’pasted
> and slightly adjusted) and also very similar, we thought that this can
> be done better.
> 
> This lead to the idea of metainit which compromises of:
>  * A small declarative file format to describe the daemon, to be shipped
>    by the package (or created by a local admin)
>  * A meatinit package that creates init scripts (or, yet to be written,
>    upstart jobs) from these files 
>  * A dh_metainit scripts to ease the inclusion of metainit files in your
>    package, that adds appropriate maintainer script snippets.
> 
> In a way, metainit is a mixture of the menu system and cdbs, for init
> scripts.
> 
I agree that it is easy to create a description of a service or task
that outlines how to run it, and how to prepare and clean-up.

I don't think you'll find it easy to encapsulate the wildly differing
ways that "init scripts" can be started or stopped by the different init
daemons.

The three principal methods on Linux are runlevels, dependencies and
events; if you wanted to support launchd, you now have the issue of
mandatory two-way communication with the init daemon, etc.

> I’d like to advocate this approach in ubuntu as well as in debian, to
> keep them as compatible as possible, and hopefully to get some more
> support when developing and spreading meatinit. 
> 
My concern is that any meta-format will be less descriptive than the
final format.  In Ubuntu, we don't have to worry about differing init
systems, since the only supported init daemon is Upstart; and that,
hopefully, already has a concise job definition format.

> I do not have the time to do maintain the ubuntu specific parts of
> metainit itself and would rather focus on the debian side. It would be
> great if someone would pick up the ubuntu part, write a spec and work
> with me to make metainit useful to ubuntu as well.
> 
Your meta format is designed around dependency-based init systems; for
the Upstart output, you'd want to convert this into states.  So a
metainit file with:

	Required-Start: foo bar baz

Would be converted into the Upstart stanza:

	while (running foo
               and running bar
               and running baz)

(Required-Stop would be "and not running ...").

Should-Start and Should-Stop are trickier to implement, since these need
to be added to the named jobs, rather than the one being processed.

This doesn't expose much of the flexibility of Upstart; in particular,
it's not possible to define anything other than a basic service - but
perhaps that's the intent here.


I do welcome your efforts, this would make our transition away from
sysvinit much easier since packages from Debian could be converted
immediately to Upstart jobs, rather than going through sysv-rc.

I suspect the likely use within Ubuntu will be primarily for packages in
Universe, and those in main that are literally just basic services.  For
services and tasks that we care about, we're likely to directly ship
Upstart definitions, since we would want the flexibility those allow.

Scott
-- 
Scott James Remnant
Ubuntu Development Manager
scott at ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/initscripts-ng-devel/attachments/20070621/d582aa0e/attachment.pgp 


More information about the initscripts-ng-devel mailing list