Files
modules/init/csh.in
Xavier Delaruelle 5a33a474d5 Use initconf in etcdir rather initdir if it exists
Take into account Modules initialization configurations found in ``etc``
directory if they exist rather in ``init`` directory. If ``initrc``
configuration file is found in ``etcdir`` then it is preferred over
``modulerc`` file in ``initdir``. Following the same trend,
``modulespath`` configuration file is found in ``etcdir`` then it is
preferred over ``.modulespath`` file in ``initdir``.
2019-07-10 07:04:52 +02:00

79 lines
4.7 KiB
Plaintext

# define module command and surrounding initial environment (default value
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init config files)
eval "`@TCLSH@ @libexecdir@/modulecmd.tcl @SHELLNAME@ autoinit`"
# no environment alteration if the above autoinit command failed
if ( $status == 0 ) then
@compatversion@ # clarify compat version is not enabled for below tests
@compatversion@ if ( ! $?MODULES_USE_COMPAT_VERSION ) then
@compatversion@ setenv MODULES_USE_COMPAT_VERSION 0
@compatversion@ endif
@compatversion@
@compatversion@ # redefine module command if compat version has been activated
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" == '1' ) then
@compatversion@ setenv MODULES_CMD @libexecdir@/modulecmd-compat ;
@compatversion@ if ( $?histchars && $?prompt ) alias module 'set _histchars = $histchars; unset histchars; set _prompt=$prompt:q; set prompt=""; eval `@libexecdir@/modulecmd-compat @SHELLNAME@ \!*`; set _exit="$status"; set histchars = $_histchars; unset _histchars; set prompt=$_prompt:q; unset _prompt; test 0 = $_exit' ;
@compatversion@ if ( $?histchars && ! $?prompt ) alias module 'set _histchars = $histchars; unset histchars; eval `@libexecdir@/modulecmd-compat @SHELLNAME@ \!*`; set _exit="$status"; set histchars = $_histchars; unset _histchars; test 0 = $_exit' ;
@compatversion@ if ( ! $?histchars && $?prompt ) alias module 'set _prompt=$prompt:q; set prompt=""; eval `@libexecdir@/modulecmd-compat @SHELLNAME@ \!*`; set _exit="$status"; set prompt=$_prompt:q;unset _prompt; test 0 = $_exit' ;
@compatversion@ if ( ! $?histchars && ! $?prompt ) alias module 'eval `@libexecdir@/modulecmd-compat @SHELLNAME@ \!*`' ;
@compatversion@ endif
@compatversion@
@compatversion@ # define function to switch between C and Tcl versions of Modules
@compatversion@ set switchml_defined="`alias switchml`"
@compatversion@ if ( "$switchml_defined" == '' ) then
@compatversion@ alias switchml 'set swfound=1; \\
@compatversion@ if ( ! $?MODULES_USE_COMPAT_VERSION ) setenv MODULES_USE_COMPAT_VERSION 0; \\
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" == "1" ) set swname="main"; \\
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" == "1" && -e @libexecdir@/modulecmd.tcl ) set swfound=0; \\
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" != "1" ) set swname="compatibility"; \\
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" != "1" && -e @libexecdir@/modulecmd-compat ) set swfound=0; \\
@compatversion@ if ( $swfound == 0 && $swname == "main" ) setenv MODULES_USE_COMPAT_VERSION 0; \\
@compatversion@ if ( $swfound == 0 && $swname == "compatibility" ) setenv MODULES_USE_COMPAT_VERSION 1; \\
@compatversion@ if ( $swfound == 0 ) echo "Switching to Modules $swname version"; \\
@compatversion@ if ( $swfound == 0 ) source @initdir@/@SHELLNAME@; \\
@compatversion@ if ( $swfound != 0 ) echo "Cannot switch to Modules $swname version, command not found"; \\
@compatversion@ unset swfound swname;'
@compatversion@ endif
@compatversion@ unset switchml_defined
@compatversion@
if ( $?tcsh && $?prompt && -r @initdir@/tcsh_completion ) then
@compatversion@ if ( "$MODULES_USE_COMPAT_VERSION" != '1' ) then
source @initdir@/tcsh_completion
@compatversion@ else
@compatversion@ # no completion support on compat version
@compatversion@ uncomplete module
@compatversion@ endif
endif
@setbinpath@
@setbinpath@ if ( ":${PATH}:" !~ '*:@bindir@:*' ) then
@setbinpath@ if ( "$PATH" == '' ) then
@setbinpath@ setenv PATH @bindir@
@setbinpath@ else
@setbinpath@@prependbinpath@ setenv PATH "@bindir@:$PATH"
@setbinpath@@appendbinpath@ setenv PATH "${PATH}:@bindir@"
@setbinpath@ endif
@setbinpath@ endif
@setbinpath@
@setmanpath@ if ( $?MANPATH ) then
@setmanpath@ set manpath = $MANPATH
@setmanpath@ else
@setmanpath@@usemanpath@ set manpath = `manpath`
@setmanpath@@notusemanpath@ set manpath = ''
@setmanpath@ # initialize MANPATH if not set with a value that preserves manpath
@setmanpath@ # system configuration even after addition of paths to this variable
@setmanpath@ # by modulefiles
@setmanpath@ setenv MANPATH :
@setmanpath@ endif
@setmanpath@ if ( ":${manpath}:" !~ '*:@mandir@:*' ) then
@setmanpath@ if ( "$MANPATH" == '' || "$MANPATH" == ':' ) then
@setmanpath@ set mlpathsep = ''
@setmanpath@ else
@setmanpath@ set mlpathsep = :
@setmanpath@ endif
@setmanpath@@prependmanpath@ setenv MANPATH "@mandir@$mlpathsep$MANPATH"
@setmanpath@@appendmanpath@ setenv MANPATH "$MANPATH$mlpathsep@mandir@"
@setmanpath@ unset mlpathsep
@setmanpath@ endif
@setmanpath@ unset manpath
endif