[Pkg-sysvinit-devel] Make init.d/skeleton a very simple init.d script?

Petter Reinholdtsen pere at hungry.com
Sun Feb 2 20:30:00 UTC 2014


[Henrique de Moraes Holschuh]
> Well, if we can leverage conditional shell parameter expansion, we
> could have default behaviour and easily override it per-package in
> the "skeleton", using constructs like ${variable:=default}, and
> ${variable:+word}.

Yeah, definitely a good approach.

I've also considered using functions that could be overriden in the
init.d scripts.  The init-d-script could contain

  do_restart() {
     ...
  }

and the init.d script could contain a different implementation:

  do_restart() {
     ... something else ...
  }

The last definition would be used. :) But it would be hard to know if
do_reload() exist and will do something sensible, so variables are
perhaps a better approach.  Is there some way to figure out if a
function exist, without calling it?

-- 
Happy hacking
Petter Reinholdtsen



More information about the Pkg-sysvinit-devel mailing list