[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: On init in Debian

On 16/03/12 21:44, Philip Hands wrote:
On Fri, 16 Mar 2012 20:05:25 +0100, Andreas Metzler<ametzler@downhill.at.eu.org>  wrote:
Philip Hands<phil@hands.com>  wrote:
On Fri, 16 Mar 2012 14:37:39 +0100, Vincent Danjean<vdanjean.ml@free.fr>  wrote:
* We could try to define a file format that allow a conversion (by a
   separate specific tool or at runtime) to various init systems.
   This would avoid to be blocked by the syntax/features of one "source"
   init system.
This was mentioned in the thread (I forget by whom) and strikes me as
the only viable strategy, in that this is the only way that the various
factions can all collaborate on making a workable solution, rather than
fighting for theirs to be The One True Init.

I am not sure this actually is a big improvement, we might end up with

* either being limited to the common featureset
* or doing something like
#ifdef systemd
elseif upstart
which is almost as bad as having to ship both init-scripts and systemd
configuration file.
If we were going to end up with anything like that, then it would be no
improvement at all, and would not be worth wasting any effort on.

I was presuming (perhaps wrongly) that it would be possible to come up
with a high level specification of what a daemon provides, what it needs
to happen in order to run, what needs to be done to provoke it to reread
its settings, how one runs it in the foreground, and in the background
(either of which might be missing) etc. etc. etc

And then, given that lot, write a generic init.d script that can take
that as input and do something useful with it, but likewise, process it
into appropriate configs for both systemd and upstart.

Of course, I don't know enough about either systemd or upstart to know
how feasible such an approach might be, but if it is feasible it would
almost certainly eliminate some of the repeated bugs in sysinit at least,
and perhaps be helpful in the same way for the other two.

On the other hand, the xkcd cartoon is depressingly true, so perhaps we
should forget that idea -- I was rather hoping that it doesn't quite
apply here though, since we'd not be trying to write yet another init,
but just describe the configuration data needed by all init type things.

Cheers, Phil.
I'm writing a system that can accept the following:

    ( name("hello-world")
    , contents
        ( sys-include("stdio.h")
        , function
            ( name("main")
            , returns("int")
            , parameters
                ( parameter(name("argc"), type("int"))
                , parameter(name("argv"), type(array(pointer("char"))))
            , body
                ( call("printf", "Hello, world!\n")
                , return(0)

and parse it into a binary form.

With this I can use a c/c++ generator program to produce

    #include <stdio.h>
    int main(int argc, char *argv[])
        printf("Hello, world!\n");
        return 0;

Would something like this help here?

Philip Ashmore

Reply to: