mirror of
https://github.com/envmodules/modules.git
synced 2026-06-03 00:33:18 +08:00
Update initialization, profile and completion scripts to enclose all references to the installation paths. Enclosing modulecmd.tcl installation path this way is not effective with the quarantine mechanism that implies a double shell code evaluation. So it is advised not to install Modules in a path containing a whitespace character if the quarantine mechanism is needed.
55 lines
1.6 KiB
Plaintext
55 lines
1.6 KiB
Plaintext
unset _mlshdbg;
|
|
# disable shell debugging for the run of this init file
|
|
if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
|
|
# immediately disable debugging to echo the less number of line possible
|
|
case "$-" in
|
|
*v*x*) set +vx; _mlshdbg='vx' ;;
|
|
*v*) set +v; _mlshdbg='v' ;;
|
|
*x*) set +x; _mlshdbg='x' ;;
|
|
*) _mlshdbg='' ;;
|
|
esac;
|
|
fi;
|
|
|
|
# define modules runtime quarantine configuration
|
|
@setquarvars@export MODULES_RUN_QUARANTINE='@RUN_QUARANTINE@'
|
|
@setquarvars@@export RUNENV_VAR='RUNENV_VAL'@
|
|
@notsetquarvars@#export MODULES_RUN_QUARANTINE='ENVVARNAME'
|
|
@notsetquarvars@
|
|
# setup quarantine if defined
|
|
unset _mlre _mlIFS;
|
|
if [ -n "${IFS+x}" ]; then
|
|
_mlIFS=$IFS;
|
|
fi;
|
|
IFS=' ';
|
|
for _mlv in ${MODULES_RUN_QUARANTINE:-}; do
|
|
if [ "${_mlv}" = "${_mlv##*[!A-Za-z0-9_]}" -a "${_mlv}" = "${_mlv#[0-9]}" ]; then
|
|
if [ -n "$(eval 'echo ${'$_mlv'+x}')" ]; then
|
|
_mlre="${_mlre:-}__MODULES_QUAR_${_mlv}='$(eval 'echo ${'$_mlv'}')' ";
|
|
fi;
|
|
_mlrv="MODULES_RUNENV_${_mlv}";
|
|
_mlre="${_mlre:-}${_mlv}='$(eval 'echo ${'$_mlrv':-}')' ";
|
|
fi;
|
|
done;
|
|
if [ -n "${_mlre:-}" ]; then
|
|
_mlre="eval ${_mlre}__MODULES_QUARANTINE_SET=1 ";
|
|
fi;
|
|
|
|
# define module command and surrounding initial environment (default value
|
|
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init config files)
|
|
eval "$(${_mlre:-}@TCLSH@ '@libexecdir@/modulecmd.tcl' bash autoinit)"
|
|
|
|
# clean temp variables used to setup quarantine
|
|
if [ -n "${_mlIFS+x}" ]; then
|
|
IFS=$_mlIFS;
|
|
unset _mlIFS;
|
|
else
|
|
unset IFS;
|
|
fi;
|
|
unset _mlre _mlv _mlrv
|
|
|
|
# restore shell debugging options if disabled
|
|
if [ -n "${_mlshdbg:-}" ]; then
|
|
set -$_mlshdbg;
|
|
unset _mlshdbg;
|
|
fi;
|