tiger-devel
[Top][All Lists]
Advanced

[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: Javier Fernandez-Sanguino
Subject: Re: [Tiger-devel] [RFC] Moving some check_root checks into OS specific checks.
Date: Fri, 27 Jun 2003 00:31:00 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01

Nicolas François wrote:
Hello all,

On Thu, Jun 26, 2003 at 09:39:52AM +0200, Javier Fernandez-Sanguino wrote:

Yes, one of the things I wanted to implement in the main engine is to be able to override common checks with local (OS-specific) checks. That's in the TODO:

"- Modify Tiger so it can use a system's scripts if it exists and substitute the one under scripts/ by introducing a run_script funcion (check if the script is under scripts and under systems/$OS/... and run it)"


I think this can be done by swapping SCRIPTDIR and LSCRIPTDIR in
tigercron :


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:

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
}

Of course, this would need to work properly with the way tiger and tigercron run scripts (redirecting output to a file) but it's generic enough that the code in tigercron which uses SCRIPTDIR/LSCRIPTDIR could be substituted with this and the calls to scripts in tiger would just need to do 'runtigerscript NAME_OF_SCRIPT'

As a matter of fact the SCRIPTDIR/LSCRIPTDIR thingy in tigercron was a first attempt to do this :-)

Regards

Javi





reply via email to

[Prev in Thread] Current Thread [Next in Thread]