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

Bug#591791: [PATCH] Document generic and upstart-specific init-system requirements



On Fri, Mar 16, 2012 at 01:07:08PM -0700, Russ Allbery wrote:

> This seems like a reasonable idea.  Steve, what do you think of having
> upstart provide such a shell library?  Then init scripts could contain
> code along the lines of:

>     if [ -r /lib/init/upstart.sh ] ; then
>         . /lib/init/upstart.sh
>         ignore_if_upstart
>     fi

> If upstart and systemd can agree on the same invocation semantics for the
> shell library, we could even provide a shell library that handled both and
> make this more generic.

I think this should all go in the lsb-base package (bug #661109).  That's
already a "standard" shell library for init scripts, which includes lots of
functions that aren't part of the LSB standard; I don't see a good reason to
contribute to a proliferation of shell libraries here.

As for making it generic, while I think there should be a similar function
for systemd, there needs to be some way for the init script to indicate
which init systems the package actually supports natively; we wouldn't want
ignore_if_not_sysvinit() for instance.

It also rubs me the wrong way to have the shell library exiting directly
from the init script.  I'd really prefer an interface such as
init_is_upstart() which leaves it open for the init script to handle some of
the mentioned corner cases - in particular, allowing for action=stop to DTRT
at all points during an upgrade.

> > Also, the proposal looks underspecified to me: What happens for other
> > actions, like stop/restart/reload/force-reload?

> My understanding is that calling those actions directly via the init
> script is not necessarily supported and invoke-rc.d should be used
> instead.  That should probably be spelled out explicitly.

Well, in the corner case of a package which calls 'invoke-rc.d restart' in
postinst, and upstart is running and we're upgrading to the first version of
the package which supports upstart, I see two options:

 - have the new version of the package call 'invoke-rc.d stop' in the
   preinst (before the upstart job is unpacked) so that the service is
   stopped via the init script.

 - have the new version of the package call '/etc/init.d/$service stop'
   explicitly in the postinst, since invoke-rc.d will now be looking at the
   upstart job instead.

I prefer the former because it respects policy's existing guidance about not
calling init scripts directly, but it also leaves a larger window when the
service will be down on upgrade - and the services that have bothered to use
'restart' in the postinst usually do so to prevent exactly this.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org

Attachment: signature.asc
Description: Digital signature


Reply to: