install_test_csh (modules-5.1.1.tar.bz2) | : | install_test_csh (modules-5.2.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
set progdir='.' | set progdir='.' | |||
endif | endif | |||
set ret=0 | set ret=0 | |||
if ( $#argv < 4 ) then | if ( $#argv < 4 ) then | |||
# print usage message | # print usage message | |||
echo "Usage: $progpath initfile mode shell command" | echo "Usage: $progpath initfile mode shell command" | |||
exit 1 | exit 1 | |||
endif | endif | |||
set initfile=$1 | set initfile="$1" | |||
shift | shift | |||
set mode=$1 | set mode=$1 | |||
shift | shift | |||
set sh=$1 | set sh=$1 | |||
shift | shift | |||
set cmdlist="$*" | set cmdlist="$*" | |||
# get shell kind and options for sublaunch | # get shell kind and options for sublaunch | |||
set shname=`basename $sh` | set shname=`basename $sh` | |||
switch ($shname) | switch ($shname) | |||
skipping to change at line 67 | skipping to change at line 67 | |||
switch ($shkind) | switch ($shkind) | |||
# ignore global csh system init file to avoid side effect | # ignore global csh system init file to avoid side effect | |||
case csh: | case csh: | |||
set shopts='-f' | set shopts='-f' | |||
breaksw | breaksw | |||
default: | default: | |||
set shopts='' | set shopts='' | |||
endsw | endsw | |||
# init module via autoinit cmd if modulecmd.tcl is initfile | # init module via autoinit cmd if modulecmd.tcl is initfile | |||
if ( "`basename $initfile`" == 'modulecmd.tcl' ) then | if ( "`basename '$initfile'`" == 'modulecmd.tcl' ) then | |||
set autoinit=0 | set autoinit=0 | |||
else | else | |||
set autoinit=1 | set autoinit=1 | |||
endif | endif | |||
if ( $autoinit == 0 && ! -x $initfile ) then | if ( $autoinit == 0 && ! -x "$initfile" ) then | |||
echo "ERROR: Cannot execute $initfile" | echo "ERROR: Cannot execute $initfile" | |||
exit 1 | exit 1 | |||
else if ( $autoinit != 0 && ! -r $initfile ) then | else if ( $autoinit != 0 && ! -r "$initfile" ) then | |||
echo "ERROR: Cannot read $initfile" | echo "ERROR: Cannot read $initfile" | |||
exit 1 | exit 1 | |||
endif | endif | |||
# source module init file if first step of given mode | # source module init file if first step of given mode | |||
if ( "$mode" == 'top' || "$mode" == 'sub' || "$mode" == 'subsub' ) then | if ( "$mode" == 'top' || "$mode" == 'sub' || "$mode" == 'subsub' ) then | |||
if ( $autoinit == 0 ) then | if ( $autoinit == 0 ) then | |||
eval "`$initfile $shname autoinit`" | eval "`'$initfile' $shname autoinit`" | |||
else | else | |||
source $initfile | source "$initfile" | |||
endif | endif | |||
endif | endif | |||
# execute command list or perform recursive call | # execute command list or perform recursive call | |||
switch ($mode) | switch ($mode) | |||
case top: | case top: | |||
case launch: | case launch: | |||
# hardcode single quote test from 080-args to correctly pass the single | # hardcode single quote test from 080-args to correctly pass the single | |||
# quotes to the module command | # quotes to the module command | |||
set hardcodetest=1 | set hardcodetest=1 | |||
skipping to change at line 139 | skipping to change at line 139 | |||
if ( $hardcodetest != 0 ) then | if ( $hardcodetest != 0 ) then | |||
foreach cmd ("`echo '${cmdlist}' | tr ';' '\n'`") | foreach cmd ("`echo '${cmdlist}' | tr ';' '\n'`") | |||
eval $cmd | eval $cmd | |||
set ret=($ret + $status) | set ret=($ret + $status) | |||
end | end | |||
endif | endif | |||
breaksw | breaksw | |||
case sub: | case sub: | |||
case sublaunch: | case sublaunch: | |||
$sh $shopts $progdir/install_test_${shkind} $initfile launch $sh "$cmdlist " | $sh $shopts $progdir/install_test_${shkind} "$initfile" launch $sh "$cmdli st" | |||
set ret=$status | set ret=$status | |||
breaksw | breaksw | |||
case subsub: | case subsub: | |||
$sh $shopts $progdir/install_test_${shkind} $initfile sublaunch $sh "$cmdl ist" | $sh $shopts $progdir/install_test_${shkind} "$initfile" sublaunch $sh "$cm dlist" | |||
set ret=$status | set ret=$status | |||
breaksw | breaksw | |||
default: | default: | |||
echo "ERROR: Unrecognized mode option. Valid mode are 'top', 'sub', 'subsu b'" | echo "ERROR: Unrecognized mode option. Valid mode are 'top', 'sub', 'subsu b'" | |||
exit 1 | exit 1 | |||
endsw | endsw | |||
# throw command exit code | # throw command exit code | |||
exit $ret | exit $ret | |||
End of changes. 8 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added |