version 0.98: fixed a bug in the error_count (missing closing brace). also implemented check to abort the tempfile sourcing if the tempfile is empty. this is to be more blackboxish, avoiding relying on the shell to do a clean up. one of our users is not using the module command correctly, and it is created a whole bunch of empty /tmp/modulescript files in the /tmp dir.

This commit is contained in:
lakata
2003-07-30 00:48:19 +00:00
parent 939f704f90
commit cd359b8ef4
2 changed files with 79 additions and 17 deletions

View File

@@ -21,6 +21,39 @@ which is the equivalent of
module load <module>/<newrev>
0. make sure you tclsh install in a sane place, ie /usr/bin or
/usr/local/bin.
(if not, you can hack modulecmd.tcl to change the path.)
1. untar in a global place that all users can see
(hint: something that is available on NFS and SAMBA is a good idea
if you
have a mix of Unix and WinNT/2000/XP users)
2. cd to init/
3. run 'make' (this just hardcodes the installation path into the
init/ files
with a perl one liner. if you don't have perl, then you can hand
edit the
files. i suppose this should have been done using tclsh, but i'm a
perl
person.)
4. edit the 'modulerc' file to point to the place where the
modulefiles are
stored.
5. instruct users to source the appropriate file inside the init/
directory, eg
source /foo/bar/modules/init/tcsh
or
. /foo/bar/modules/init/zsh
Be sure to run 'make' in the init directory, to create the
initialization scripts.
@@ -28,3 +61,4 @@ initialization scripts.
-Mark Lakata <lakata@mips.com>
Nov 29, 2002
May 30, 2003

View File

@@ -25,6 +25,7 @@ set ignoreDIr(RCS) 1
set ignoreDir(SCCS) 1
set g_reloadMode 0
set error_count 0
set g_force 0
proc module-info {what {more {}}} {
upvar g_mode mode
@@ -446,8 +447,8 @@ proc renderSettings {} {
global env g_Aliases g_shellType g_shell
global g_stateEnvVars g_stateAliases
global g_newXResources g_delXResources
global error_count
set iattempt 0
set f ""
while {$iattempt < 100 && $f == ""} {
@@ -629,6 +630,12 @@ proc renderSettings {} {
}
}
}
set nop 0
if { $error_count == 0 && ! [tell $f] } {
set nop 1
}
switch $g_shellType {
csh {
puts $f "/bin/rm -f $tmpfile"
@@ -655,29 +662,51 @@ proc renderSettings {} {
}
perl {
# HMS: is this right?
puts $f "die 'modulefile.tcl: $error_count error(s) detected!\n'"
puts $f "die \"modulefile.tcl: $error_count error(s) detected!\\n\""
}
python {
# I am not a python programmer...
}
}
set nop 0
}
close $f
fconfigure stdout -translation lf
switch $g_shellType {
csh {
puts "source $tmpfile"
if {$nop} {
# puts stderr "WARNING: nothing written!"
file delete $tmpfile
switch $g_shellType {
csh {
puts "/bin/true"
}
sh {
puts "/bin/true"
}
perl {
puts "1;"
}
python {
# this is not correct
puts ""
}
}
sh {
puts ". $tmpfile"
}
perl {
puts "require \"$tmpfile\";"
}
python {
# this is not correct
puts "exec '$tmpfile'"
} else {
switch $g_shellType {
csh {
puts "source $tmpfile"
}
sh {
puts ". $tmpfile"
}
perl {
puts "require \"$tmpfile\";"
}
python {
# this is not correct
puts "exec '$tmpfile'"
}
}
}
}
@@ -1161,7 +1190,6 @@ global g_shellType
set g_shell [lindex $argv 0]
set command [lindex $argv 1]
set argv [lreplace $argv 0 1]
set g_force 1
switch -regexp $g_shell {
^(sh|bash|ksh|zsh)$ {
@@ -1253,7 +1281,7 @@ catch {
}
default {
puts stderr {
ModulesTcl 0.97:
ModulesTcl 0.98:
Available Commands and Usage:
add|load modulefile [modulefile ...]
rm|unload modulefile [modulefile ...]