[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tiger-devel] [RFC] Moving some check_root checks into OS specific c
From: |
Nicolas François |
Subject: |
Re: [Tiger-devel] [RFC] Moving some check_root checks into OS specific checks. |
Date: |
Fri, 27 Jun 2003 19:53:39 +0200 |
User-agent: |
Mutt/1.5.4i |
On Fri, Jun 27, 2003 at 12:31:00AM +0200, Javier Fernandez-Sanguino wrote:
> This would work only for tigercron. I was thinking more on the line of
> providing a new function in initdefs (which gets sourced by both tiger
> and tigercron) called 'runtigerscript' which basicly would do the
> something similar to:
You're right, I didn't thought about other executions of scripts.
Moreover, a runtigerscript function would avoid having to define the
SCRIPTDIR/LSCRIPTDIR variables in every config files.
> runtigerscript ()
> {
> script="$1"
> # BASEDIR and SCRIPTDIR have been defined by config
> SYSDIR="$BASEDIR/systems"
> # The default
> RUNSCRIPT="$SCRIPTDIR/$script"
> if [ -f "$SYSDIR/$OS/$REL/$REV/$ARCH/$script" ]; then
> RUNSCRIPT="$SYSDIR/$OS/$REL/$REV/$ARCH/$script"
> elif [ -f "$SYSDIR/$OS/$REL/$REV/$script" ]; then
> RUNSCRIPT="$SYSDIR/$OS/$REL/$REV/$script"
> elif [ -f "$SYSDIR/$OS/$REL/config" ]; then
> RUNSCRIPT="$SYSDIR/$OS/$REL/$script"
> elif [ -f "$SYSDIR/$OS/$script" ]; then
> RUNSCRIPT="$SYSDIR/$OS/$script"
> fi
> if [ -x "$RUNSCRIPT" ] ; then
> $RUNSCRIPT
> else
> echo "Cannot execute $script (no suitable version found)"
> fi
> }
This sounds good :)
Perhaps you can check the executable flag while you try to find the
script:
if [ -x "$SYSDIR/$OS/$REL/$REV/$ARCH/$script" ]; then
...
elif [ -x ...
In other words, what should be done if the OS specific script exists but
is not executable:
- no execution of the script
- error 'Cannot execute $script' (or 'Cannot execute $RUNSCRIPT')
- error 'No suitable version found'
- execution of the generic script (if found and executable)
- other ?
Regards
--
Nekral