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

Re: init script config files



"Christopher W. Curtis" wrote:

> A (I hope) pertinent example:  I don't like portmap in the required
> package netbase.  I don't like the existing "solution" for diasbling
> it.  Why?  This is me.  Who cares, I'm providing an alternative.  Look
> at /etc/init.d/portmap.  I'm going to rewrite this script using my
> 'defaults' library as example:
> 
> --------------------------------------------------
> #!/bin/sh
> #
> # start/stop portmap daemon.
> 
> . /etc/init.d/defaults portmap
[...]
> --------------------------------------------------


Okay.  Joey Hess doesn't like two files containing variables.  I can
understand this.  A reasonable solution would be to change the above
segment to include the 'defaults' file before sourcing, as such:

> --------------------------------------------------
NAME="portmap daemon"
TERM="Stopping $NAME"
RUN_PORTMAP=1
. /etc/init.d/defaults portmap
> --------------------------------------------------

and 'defaults' only sources /etc/init.d/defaults.d/portmap and the
portmap.user file goes away.  Having the two seperate simply makes it
easier to create a .user file by copying the default file.  I, of
course, still prefer the 'defaults' approach over sourcing the file
directly for the other (imo) benefits.

> Now, if the user wants to turn off portmap, (s)he can just:
> 
> echo "RUN_PORTMAP=0" > /etc/init.d/defaults.d/portmap.user

Or, as I wanted to add, can:

echo "exit 0" > /etc/init.d/defaults.d/portmap{.user}

Christopher



Reply to: