mirror of
https://github.com/envmodules/modules.git
synced 2026-05-30 00:12:31 +08:00
93 lines
4.0 KiB
Plaintext
93 lines
4.0 KiB
Plaintext
@silentshdbgsupport@unset _mlshdbg;
|
|
@silentshdbgsupport@# disable shell debugging for the run of this init file
|
|
@silentshdbgsupport@if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
|
|
@silentshdbgsupport@ # immediately disable debugging to echo the less number of line possible
|
|
@silentshdbgsupport@ case "$-" in
|
|
@silentshdbgsupport@ *v*x*) set +vx; _mlshdbg='vx' ;;
|
|
@silentshdbgsupport@ *v*) set +v; _mlshdbg='v' ;;
|
|
@silentshdbgsupport@ *x*) set +x; _mlshdbg='x' ;;
|
|
@silentshdbgsupport@ *) _mlshdbg='' ;;
|
|
@silentshdbgsupport@ esac;
|
|
@silentshdbgsupport@fi;
|
|
@silentshdbgsupport@
|
|
@quarantinesupport@# define modules runtine quarantine configuration
|
|
@quarantinesupport@@setquarvars@export MODULES_RUN_QUARANTINE='@RUN_QUARANTINE@'
|
|
@quarantinesupport@@setquarvars@@export RUNENV_VAR='RUNENV_VAL'@
|
|
@quarantinesupport@@notsetquarvars@#export MODULES_RUN_QUARANTINE='ENVVARNAME'
|
|
@quarantinesupport@@notsetquarvars@
|
|
@quarantinesupport@# setup quarantine if defined
|
|
@quarantinesupport@unset _mlre _mlIFS;
|
|
@quarantinesupport@if [ -n "${IFS+x}" ]; then
|
|
@quarantinesupport@ _mlIFS=$IFS;
|
|
@quarantinesupport@fi;
|
|
@quarantinesupport@IFS=' ';
|
|
@quarantinesupport@for _mlv in ${MODULES_RUN_QUARANTINE:-}; do
|
|
@quarantinesupport@ if [ "${_mlv}" = "${_mlv##*[!A-Za-z0-9_]}" -a "${_mlv}" = "${_mlv#[0-9]}" ]; then
|
|
@quarantinesupport@ if [ -n "`eval 'echo ${'$_mlv'+x}'`" ]; then
|
|
@quarantinesupport@ _mlre="${_mlre:-}${_mlv}_modquar='`eval 'echo ${'$_mlv'}'`' ";
|
|
@quarantinesupport@ fi;
|
|
@quarantinesupport@ _mlrv="MODULES_RUNENV_${_mlv}";
|
|
@quarantinesupport@ _mlre="${_mlre:-}${_mlv}='`eval 'echo ${'$_mlrv':-}'`' ";
|
|
@quarantinesupport@ fi;
|
|
@quarantinesupport@done;
|
|
@quarantinesupport@if [ -n "${_mlre:-}" ]; then
|
|
@quarantinesupport@ _mlre="eval ${_mlre}";
|
|
@quarantinesupport@fi;
|
|
@quarantinesupport@
|
|
# define module command and surrounding initial environment (default value
|
|
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init config files)
|
|
@quarantinesupport@_mlcode=`${_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl ksh autoinit`
|
|
@notquarantinesupport@_mlcode=`@TCLSH@ @libexecdir@/modulecmd.tcl ksh autoinit`
|
|
_mlret=$?
|
|
|
|
@quarantinesupport@# clean temp variables used to setup quarantine
|
|
@quarantinesupport@if [ -n "${_mlIFS+x}" ]; then
|
|
@quarantinesupport@ IFS=$_mlIFS;
|
|
@quarantinesupport@ unset _mlIFS;
|
|
@quarantinesupport@else
|
|
@quarantinesupport@ unset IFS;
|
|
@quarantinesupport@fi;
|
|
@quarantinesupport@unset _mlre _mlv _mlrv
|
|
@quarantinesupport@
|
|
# no environment alteration if the above autoinit command failed
|
|
if [ $_mlret -eq 0 ]; then
|
|
eval "$_mlcode"
|
|
|
|
@setbinpath@
|
|
@setbinpath@ _mlinstr=":$PATH:"
|
|
@setbinpath@ if [ "${_mlinstr#*:@bindir@:}" = "$_mlinstr" ]; then
|
|
@setbinpath@@prependbinpath@ PATH=@bindir@${PATH:+:}$PATH
|
|
@setbinpath@@appendbinpath@ PATH=$PATH${PATH:+:}@bindir@
|
|
@setbinpath@ export PATH
|
|
@setbinpath@ fi
|
|
@setmanpath@
|
|
@setmanpath@ # initialize MANPATH if not set with a value that preserves manpath system
|
|
@setmanpath@ # configuration even after addition of paths to this variable by modulefiles
|
|
@setmanpath@ if [ ! -n "${MANPATH+x}" ]; then
|
|
@setmanpath@ MANPATH=:
|
|
@setmanpath@ export MANPATH
|
|
@setmanpath@ fi
|
|
@setmanpath@@usemanpath@ _mlinstr=":`manpath 2>/dev/null`:"
|
|
@setmanpath@@notusemanpath@ _mlinstr=":$MANPATH:"
|
|
@setmanpath@ if [ "${_mlinstr#*:@mandir@:}" = "$_mlinstr" ]; then
|
|
@setmanpath@ if [ "$MANPATH" = ':' ] || [ "$MANPATH" = '' ]; then
|
|
@setmanpath@ _mlpathsep=''
|
|
@setmanpath@ else
|
|
@setmanpath@ _mlpathsep=:
|
|
@setmanpath@ fi
|
|
@setmanpath@@prependmanpath@ MANPATH=@mandir@$_mlpathsep$MANPATH
|
|
@setmanpath@@appendmanpath@ MANPATH=$MANPATH$_mlpathsep@mandir@
|
|
@setmanpath@ export MANPATH
|
|
@setmanpath@ unset _mlpathsep
|
|
@setmanpath@ fi
|
|
unset _mlinstr
|
|
fi
|
|
|
|
unset _mlcode _mlret
|
|
@silentshdbgsupport@
|
|
@silentshdbgsupport@# restore shell debugging options if disabled
|
|
@silentshdbgsupport@if [ -n "${_mlshdbg:-}" ]; then
|
|
@silentshdbgsupport@ set -$_mlshdbg;
|
|
@silentshdbgsupport@ unset _mlshdbg;
|
|
@silentshdbgsupport@fi;
|