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

Re: On init in Debian



On Sat, 17 Mar 2012 18:23:57 +0800, Thomas Goirand <zigo@debian.org> wrote:
> On 03/17/2012 08:10 AM, Fernando Lemos wrote:
> > Right now, creating a init script means copying an ugly 159-line
> > skeleton and carefully editing it, hoping not to break anything while
> > at it. Even if we can't have a single generator for multiple init
> > systems, having something declarative to build most init scripts we
> > need would be a big step forward and it would make a lot of sense as
> > well in a future where we may need to support multiple init systems.
> >   
> 
> Yes!
> 
> Having a shell script library for that would make it more declarative,
> and less imperative, so we wouldn't have to write all of the script.
> 
> For me, that'd be quite easy enough. I'm proposing myself to write
> such library if nobody wants to do it, but of course, I would need some
> others to review my work. The ultimate goal would be that packages
> would simply need to do something like:
> 
> NAME=package-binary-file
> DESC="package daemon description"
> 
> [ -e . /usr/share/sysv-lib/debsysv-lib ] && debsysv-init-lib $@

I'm happy to help with that ... although, I doubt we're the first people
to think of something like this, and it would be a shame to ignore an
existing solution.

RedHat have some functions for use in init scripts, in
/etc/rc.d/functions (although I've not used RedHat for a decade or more,
so I've no idea what's included there).

OpenWRT does something quite interesting, which is that they have an
/etc/rc.common and then make the init scripts start thus:

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2006 Carlos Sobrinho

NAME=dropbear
PROG=/usr/sbin/dropbear
START=50
STOP=50
PIDCOUNT=0
...

so the thing that actually gets run is the /etc/rc.common, which sources
the init.d script at its end, so it is possible to override any part of
the common script by including functions in the service specific script,
but otherwise it just does the default.

Any others?

Cheers, Phil.
-- 
|)|  Philip Hands [+44 (0)20 8530 9560]    http://www.hands.com/
|-|  HANDS.COM Ltd.                    http://www.uk.debian.org/
|(|  10 Onslow Gardens, South Woodford, London  E18 1NE  ENGLAND

Attachment: pgpu3YIGsEymO.pgp
Description: PGP signature


Reply to: