Files
modules/init/bash.in
2021-07-24 14:06:09 +02:00

104 lines
4.3 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 bash autoinit`
@notquarantinesupport@_mlcode=`@TCLSH@ @libexecdir@/modulecmd.tcl bash 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"
# export functions to get them defined in sub-shells
if [ -t 2 ]; then
export -f _module_raw
fi
export -f module
if [ "$(type -t ml)" = 'function' ]; then
export -f ml
fi
# enable completion only in interactive mode
if [ ${BASH_VERSINFO:-0} -ge 3 ] && [[ $- =~ i ]] &&
[ -r @initdir@/bash_completion ]; then
source @initdir@/bash_completion
fi
@setbinpath@
@setbinpath@ if [[ ! ":$PATH:" =~ ':@bindir@:' ]]; 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@ if [[ ! ":`manpath 2>/dev/null`:" =~ ':@mandir@:' ]]; then
@setmanpath@@notusemanpath@ if [[ ! ":$MANPATH:" =~ ':@mandir@:' ]]; 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
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;