On Thu, May 30, 2013 at 10:41:56PM +0100, Ben Hutchings wrote: > On Thu, May 30, 2013 at 02:07:10PM -0700, Steve Langasek wrote: > > On Thu, May 30, 2013 at 10:00:40PM +0100, Ben Hutchings wrote: > > > On Thu, May 30, 2013 at 10:39:55PM +0200, Ondřej Surý wrote: > > > > Practical question: if I were to support systemd .service, upstart > > > > init job and/or OpenRC <whatever> together with standard sysvinit > > > > script, how do I check for currently used init system from sysvinit > > > > script to not start the service for a second time?
> > > . /lib/lsb/init-functions > > > (Which should be near the top of your init script already.) > > > This will automagically invoke systemd or upstart if appropriate. > > No, it won't. What it will do is provide a shell function you can call to > > check if init is upstart, and if so, neuter your init script: > > if init_is_upstart; then > > exit 1 > > fi > > Doing this automatically by including /lib/lsb/init-functions would be EBW. > I feel it would be DWIM. It really is what systemd does, but I'm sure > that merely confirms your opinion. ;-) Heh. :) > If I understand you correctly: > - For services without an upstart job, the init script can start or > stop a daemon outside of the control of upstart. > - For services with an upstart job, the init script needs this > explicit check and will fail *without any error message* if upstart > is running. (I seem to recall, now, that upstart does not assume > any relationship between similarly named jobs and init scripts.) > Now I realise we should all really use the 'service' command, but > that really seems like an extremely ungraceful degradation of the > behaviour of directly invoked init scripts. Well, the current requirements for init scripts v. upstart jobs have been vetted on debian-policy@ and are included in the current version of Policy; but this isn't set in stone. If folks feel strongly that init scripts should be made pass-throughs to upstart instead of no-ops, that's absolutely doable. I don't think we discussed this specifically in the policy bug, but for my part I ruled it out because I wasn't particularly keen on the idea that for every single init script belonging to a package that is *not* upstart-enabled, the shell library will be making various calls to 'initctl' on its behalf, causing an unnecessary boot speed penalty. -- 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/ slanga...@ubuntu.com vor...@debian.org
signature.asc
Description: Digital signature