Re: RFC: fix for daemon start (2)

2000-09-14 Thread Henrique M Holschuh
On Wed, 13 Sep 2000, Miquel van Smoorenburg wrote:
 I like it, but why not fold this functionality in update-rc.d itself?
 update-rc.d --query ? And why not define update-rc.d --list as well..

Well, for starters I don't grok perl, and I wasn't about to let that little
detail stop me from writing the sample code :-)

Also, update-rc.d and initscriptquery don't share much in the way of common
code, I think. I don't see any major advantages in merging the two, not to 
mention that it would generate a new interface for update-rc.d...

By keeping the two scripts separate, we avoid increasing the complexity of
update-rc.d and we also keep the two interfaces independent of each other.

-- 
  One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie. -- The Silicon Valley Tarot
  Henrique Holschuh


pgpkHs9pOdebR.pgp
Description: PGP signature


RFC: fix for daemon start (2)

2000-09-13 Thread Henrique M Holschuh
Hello everyone,

Here's an updated version of the RFC text, as well as a new version of the
initscriptquery reference script. The fragments.sh script is included just
for completeness, and was not modified.

Changelog:
 * fixed typos, updated documentation to an assertive tone
 * addressed rcS.d issue (I received no comments on this one, BTW)
 * handle multiple links per runlevel nicely
 * detect and block attempt to run initscriptquery at runlevel 0 or 6
 * address pre-depends/depends issue

Another small RFC dealing with administrative policy enforcement on the
start of initscripts will be sent in a few days. Due to the design of
initscriptquery, such policy enforcement could be done without any
additional changes to other packages.

There are no technical issues left for initscriptquery that I know of. It
should be now in its nearly final state.


RFC: Fix for initscripts being run out of their intended runlevel by
 package scripts (during package installs and upgrades).


Interface proposal for /usr/sbin/initscriptquery script:


Assumptions:
  Debian uses only sysvinit-compatible initscripts, stored in /etc/init.d/
  (currently true for debian, file-rc uses the same /etc/init.d/ scripts as
  sysvinit does).

  The unique identifier for an initscript is the initscript ID required by
  the update-rc.d command.

Documented Command Line Interface:
  /usr/sbin/initscriptquery [-q] initscript ID

  -q : Run initscriptquery in silent mode, errors are NOT reported to stderr
  initscript ID:  the update-rc.d identifier for the initscript

  Future versions to this script MUST be fully backwards compatible.

Documented behaviour of the initscriptquery script:

   stdin shall not be used (it is NOT an interactive script)
   stdout shall be used only to output usage information.
   stderr shall be used to output all error messages.
   
   Exit status codes:
0 - the initscript is allowed to be started
1 - the initscript is NOT allowed be started
2 - initscript ID unknown
3 - initscript ID known, but behaviour is undefined
4 - syntax error
  =5 - other error (usually means inconsistency in the underlining
initscript subsystem)

Verbose description of the exit status codes:

0 - the initscript is allowed to be started

sysvinit meaning: There is a non-dangling, executable S?? link in
the rc?.d directory for the given script ID and current runlevel.

Also, no other administrative reasons for not starting the init
scripts exist.

NOTE: If an initscript would be started at the S runlevel, it is
assumed that this should be true for all runlevels that don't
actually stop the initscript as well.

Desired behaviour: Call /etc/init.d/initscript as you'd have done
before the advent of initscriptquery

1 - the initscript is NOT allowed be started

sysvinit meaning: There is a non-dangling, executable K?? link (and
no S?? link) in the rc?.d directory for the given script ID and
current runlevel.

Or, an administrative reason prohibits starting the initscript.

Desired behaviour: Do not run the initscript. If the daemon is
running, assume it's because the user started it manually and would
like it to be left alone (feel free to issue a warning, though).

2 - initscript ID unknown

sysvinit meaning: There isn't a normal file with the name matching
initscript ID in /etc/init.d/ (note that the existence of a
S??initscriptID link/file is NOT enough, as we are constrained to
the same namespace used by update-rc.d).

This might happen if update-rc.d fails, if you forget to run
update-rc.d BEFORE initscriptquery in the package scripts, or if the
user removed the /etc/init.d/ script.

Desired behaviour: Do whatever is appropriate for your package.
Unless -q was given, initscriptquery will have already printed a
warning to stderr. The calling script might want to try to start the
script anyway (which will probably fail, BTW). 

3 - initscript ID known, but behaviour is undefined

sysvinit meaning: No S?? or K?? link in the proper rc?.d directory
for the given initscript ID was found, but a /etc/init.d/ file for
the given initscript iD does exist.

Desired behaviour: For non-daemon-starting initscripts, it is
undefined. Do whatever is *safer* for your package (start it anyway,
do nothing, or stop it).

Never start a daemon which isn't already running if you receive this
status code. You can either restart the daemon, stop the daemon, or
do nothing.  WARNING: don't use /etc/init.d/initscript restart for
this operation unless the initscript is under your control, and
known not to start a daemon which was not running.

4 - Syntax error

Re: RFC: fix for daemon start (2)

2000-09-13 Thread Florian Lohoff
On Wed, Sep 13, 2000 at 10:01:11AM -0300, Henrique M Holschuh wrote:
 Sample code:
 
 
   Attached to this rfc, you'll find a reference (functional and somewhat
   tested, as well as written for easy-of-reading) shell script
   implementation of /usr/sbin/initscriptquery for sysvinit.  If someone else
   would like to rewrite it better, or in perl, or whatever... go ahead :-)
 
   Also attached to this rfc, you'll find a sample fragment of a postinst
   script which uses initscriptquery to run a daemon. It's a bit big because
   of the comments, but it's quite simple and very easy to read and
   understand.  Again, if anyone cares to write a better example, you're
   welcome.

I would like to have an addition to the initscriptquery which
is something i have been waiting for long. I am interested in this
because i am doing automated installations into a chroot environment.
In this case i am possibly running in the right runlevel but i still
dont want to have Daemons to be startet. So i would like to have a possibility
to override the initscriptquery decision or more or less set an env var
saying DPKG_NOSTARTDAEMONS=1 or something like this.

Flo
-- 
Florian Lohoff  [EMAIL PROTECTED]   +49-5201-669912
  Write only memory - Oops. Time for my medication again ...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: RFC: fix for daemon start (2)

2000-09-13 Thread Henrique M Holschuh
On Wed, 13 Sep 2000, Florian Lohoff wrote:
 I would like to have an addition to the initscriptquery which
 is something i have been waiting for long. I am interested in this
 because i am doing automated installations into a chroot environment.
 In this case i am possibly running in the right runlevel but i still
 dont want to have Daemons to be startet. So i would like to have a possibility
 to override the initscriptquery decision or more or less set an env var
 saying DPKG_NOSTARTDAEMONS=1 or something like this.

This issue falls under the soon-to-be-posted-to-debian-devel RFC for local
administrative control of initscript starts.

It allows you to do the above, yes.  It's just that I didn't write the code
yet, and I *know* the issue can start a flame war if I don't use severe
helpings of flame-retardants like posting the code up front (so that people
can actually look at it, and notice it will not do any weird crap to their
systems, especially if they DON'T want such administrative control in their
machine).

-- 
  One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie. -- The Silicon Valley Tarot
  Henrique Holschuh


pgpyZQg3NlSmP.pgp
Description: PGP signature


Re: RFC: fix for daemon start (2)

2000-09-13 Thread Miquel van Smoorenburg
In article [EMAIL PROTECTED],
Henrique M Holschuh  [EMAIL PROTECTED] wrote:
Here's an updated version of the RFC text, as well as a new version of the
initscriptquery reference script. The fragments.sh script is included just
for completeness, and was not modified.

I like it, but why not fold this functionality in update-rc.d itself?
update-rc.d --query ? And why not define update-rc.d --list as well..

[BTW, sysvinit should probably be split into 3 packages - binaries,
 initscripts, and sysvinitscripts, the latter could be replaced by
 the file-rc stuff, and update-rc.d should be part of the latter]

Mike.
-- 
Deadlock, n.:
Deceased rastaman.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]