Files
modules/init/fish.in
Xavier Delaruelle 956b377873 Restore quarantine if __MODULES_QUARANTINE_SET defined
Introduce the __MODULES_QUARANTINE_SET environment variable to put back
when starting modulecmd.tcl run the environment set on hold by
initialization script (for autoinit calls) or by module shell function
(for regular calls).

This new environment variable is tested to apply quarantine unhold
mechanism instead of checking if the run_quarantine configuration option
is set and shell accurately supports the mecanishm. With this change it
is possible to enable or disable the quarantine support at module
initialization time (through initrc configuration file) instead of
freezing this configuration when building the modulecmd.tcl script.
2021-08-25 07:29:16 +02:00

58 lines
2.2 KiB
Plaintext

# define modules runtine quarantine configuration
@setquarvars@set -xg MODULES_RUN_QUARANTINE '@RUN_QUARANTINE@'
@setquarvars@@set -xg RUNENV_VAR 'RUNENV_VAL'@
@notsetquarvars@#set -xg MODULES_RUN_QUARANTINE 'ENVVARNAME'
@notsetquarvars@
# setup quarantine if defined
set _mlre '';
for _mlv in (string split ' ' $MODULES_RUN_QUARANTINE)
if string match -r '^[A-Za-z_][A-Za-z0-9_]*$' $_mlv >/dev/null
if set -q $_mlv
set _mlre $_mlre"__MODULES_QUAR_"$_mlv"='$$_mlv' "
end
set _mlrv "MODULES_RUNENV_$_mlv"
set _mlre "$_mlre$_mlv='$$_mlrv' "
end
end
if [ -n "$_mlre" ]
set _mlre "env $_mlre __MODULES_QUARANTINE_SET=1"
end
# 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 fish autoinit | source -
# no environment alteration if the above autoinit command failed
if [ $status -eq 0 ]
if status -i
if [ -r @initdir@/fish_completion ]
source @initdir@/fish_completion
end
end
@setbinpath@ if not contains @bindir@ $PATH
@setbinpath@@prependbinpath@ set -xg PATH @bindir@ $PATH
@setbinpath@@appendbinpath@ set -xg PATH $PATH @bindir@
@setbinpath@ end
@setbinpath@
@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 not set -q MANPATH
@setmanpath@ set -xg MANPATH :
@setmanpath@ end
@setmanpath@@usemanpath@ if not string match -q '*:@mandir@:*' :(manpath 2>/dev/null):
@setmanpath@@notusemanpath@ if not string match -q '*:@mandir@:*' :$MANPATH:
@setmanpath@ if [ -z "$MANPATH" -o "$MANPATH" = ':' ]
@setmanpath@ set _mlpathsep ''
@setmanpath@ else
@setmanpath@ set _mlpathsep :
@setmanpath@ end
@setmanpath@@prependmanpath@ set -xg MANPATH @mandir@$_mlpathsep$MANPATH
@setmanpath@@appendmanpath@ set -xg MANPATH $MANPATH$_mlpathsep@mandir@
@setmanpath@ set -e _mlpathsep
@setmanpath@ end
end
# clean temp variables used to setup quarantine
set -e _mlre; set -e _mlv; set -e _mlrv;