init: API

Răzvan Corneliu C.R. "d3vi1" VILT razvan.vilt at linux360.ro
Fri Nov 18 16:46:09 UTC 2005


On Fri, 2005-11-18 at 00:20 +0200, Gilboa Davara wrote: 

> I, too, second the "anything but XML" statement.
> A. Hard to read.
> B. Hard to edit using non-XML editors. (vim in my case)
> C. Tends to create needlessly-complex data structures.
> D. While can be accessed using shell scripts, it requires very complex
> and unreadable code.
> 
> On the other hand, what does XML offer in return?
> 
> Gilboa
> 

I don't second that. Today XML is the format everybody uses. Why?
Because it's a standardised way to put any kind of information in a
text-file.
A. Depends on how the schema is created. XML files can be easy to read
or dificult. Identing the xml code always helps.
B. Colored syntax always helps. That's all you usually need. At least
it's enough for me. I must say that Midnight Commander seems to work
with XML a little better.
C. Depends on the schema.
D. It does not require complex code, it requires well designed tools. In
a XML based init world, you would need chkconfig and other tools. XML
authoring should be done only by the package maintainers. The rest
should be doable by external tools which share a common API.

XML could help major projects such as the directory server bypass the
limitations of the current sysvinit. Check the problems with the
currently proposed init scripts in the fedora-ds wiki.
I've included in this email a demo of a service configuration file for
Sun SMF. Don't worry, it's not CDDL-ed. You are not contaminated if you
read this.
The interesting stuff this file brings:
1) Internationalize the service descriptions (the xml:lang attribute is
a dream for i18n in this case).
2) Include information about the documentation.
3) Include dependency information.
4) Include the start-up and shutdown commands.
There are a lot of other things that can be done using this XML file.
These are just a few of the ones that I consider important. I've added
gEdit style syntax color in the HTML version ;-).

Cheers,
Razvan

<service name='system/coreadm' type='service' version='1'>
   <create_default_instance enabled='false' />
    <single_instance />
    <dependency name='usr' grouping='require_all' restart_on='none'
type='service'>
        <service_fmri value='svc:/system/filesystem/minimal'/>
    </dependency>
    <exec_method type='method' name='start' exec='/usr/bin/coreadm -u'
timeout_seconds='3' />
    <exec_method type='method' name='stop' exec=':true'
timeout_seconds='0' />
    <property_group name='startd' type='framework'>
        <propval name='duration' type='astring' value='transient' />
    </property_group>
    <stability value='Unstable' />
    <template>
        <common_name><loctext xml:lang='C'>
            System-wide core file configuration service.
        </loctext></common_name>
        <documentation>
            <manpage title='coreadm' section='1M'
manpath='/usr/share/man' />
        </documentation>
    </template>
</service>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/devel/attachments/20051118/45ed327f/attachment-0002.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smiley-4.png
Type: image/png
Size: 822 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/devel/attachments/20051118/45ed327f/attachment-0002.png 


More information about the devel mailing list