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

Re: Re: Bug#225465: debian-policy: packages must give choice to notstart at boot, via debconf

Hi all,

[please make me CC, i am not in this list]

Great idea, that is a long time that I would like to suggest such a way (as hpux does) to manage easily startup process but I never manage to find the right ml to suggest it.

To share my experience, hpux uses to place its statup config files in /etc/rc.config.d. Nice place isn't it? But I don't know if it is possible to use it without violating some patent?

I also noticed that since hp-ux 11.00 some process could only be started via their startup link (ie /sbin/rci.d/Sxxprocess) and couldn't by the startup script (ie /sbin/init.d/process).

> Will Lowe writes:
> > I abhor init scripts that do something like:
> > #!/bin/sh
> > . /etc/default/$package # this contains "RUN_AT_BOOT=YES"
> > test "$RUN_AT_BOOT" -eq "YES" || exit 0
> Try:
> . /etc/default/package # this contains "RUN_package_AT_BOOT"
> test -z "$RUN_package_AT_BOOT" && echo $0 | grep -q '^S' && exit 0

hmm I try also try this example but failed to me (I use bash; does it works for another shell?)
I do have at least to put 'RUN_package_AT_BOOT=' in /etc/default/$package

So by default we would have to set RUN_package_AT_BOOT=1 or RUN_package_AT_BOOT="yes". And I feel so that the common behavior would be to reverse this value (=0 or ="no"), also I prefer the previous test.

Now I not quite sure how startup scripts are launched:
I mean if /etc/rci.d is added in the PATH then ok "echo $0 | grep -q '^S'" would work OTC not?

In conclusion here is a small header which I would suggested:
# set -x

StartCfgFile="/etc/default/package" # this contains "RUN_package_AT_BOOT=yes"

KS=${KS%%[0-9][0-9]} # to be sure that it is well a [KS][:digit:][:digit:]

if [ -f ${StartCfgFile} ] ; then
    . ${StartCfgFile}
    echo "Default S/K config file (${StartCfgFile}) is absent!" >&2
    echo "So start/stop skipped. Please check!" >&2
    exit 2

if [ "${KS}" == "S" ] || [ "${KS}" == "K" ] ; then
    if [ "${RUN_package_AT_BOOT:0:1}" != "Y" ] && [ "${RUN_package_AT_BOOT:0:1}" != "y" ] ; then
        echo "Start/stop skipped (see ${StartCfgFile})." >&2
        exit 2

Its major inconvience: not applicable for all shell :(


Reply to: