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

RfD: Policy of .sh boot scripts



In /etc/* there are severeal scripts that are named *.sh.  Most of
them are not marked executable and don't contain a "#! /bin/sh" line.

Thus, to run them you need to "sh foo.sh" or "source foo.sh" them.
This raises a problem if the script contains code like "test -x foo ||
exit 0".  This would cause the executing shell to be terminated if it
uses source to run the script.

Therefore I believe that either of the following has to be made
policy:

 a) Scripts in /etc/init.d, /etc/rc.boot and similar directories that
    have the ".sh" suffix may be run by source'ing them.  Thus they
    must not contain any `exit' statements.  If they need to quit the
    script they have to use return instead

 b) All scripts in /etc/init.d, /etc/rc.boot and similar directories
    have to be standalone shell scripts.  They must have the 'x' flag
    turned on and contain a regular command to execute them in the
    first line (such as "#! /bin/sh").  They must not be called *.sh.

A mixture of this does not make sense imho:

   What is the benefit of *.sh scripts if one has to call a shell to
   execute them and isn't allowed to source them?  In that case they
   should contain the command to execute them - thus be a standalone
   script.

Regards,

	Joey

-- 
We all know Linux is great... it does infinite loops in 5 seconds.
        - Linus Torvalds

Attachment: pgpkwqJCfidvX.pgp
Description: PGP signature


Reply to: