mirror of
https://github.com/envmodules/modules.git
synced 2026-06-03 00:33:18 +08:00
Add the ability to control whether or not code to support quarantine mechanism should be added to the module function and initialization scripts. Enabled by default Fixes #167
58 lines
2.5 KiB
Plaintext
58 lines
2.5 KiB
Plaintext
@quarantinesupport@# define modules runtine quarantine configuration
|
|
@quarantinesupport@@setquarvars@set -xg MODULES_RUN_QUARANTINE '@RUN_QUARANTINE@'
|
|
@quarantinesupport@@setquarvars@@set -xg RUNENV_VAR 'RUNENV_VAL'@
|
|
@quarantinesupport@@notsetquarvars@#set -xg MODULES_RUN_QUARANTINE 'ENVVARNAME'
|
|
@quarantinesupport@@notsetquarvars@
|
|
@quarantinesupport@# setup quarantine if defined
|
|
@quarantinesupport@set _mlre '';
|
|
@quarantinesupport@for _mlv in (string split ' ' $MODULES_RUN_QUARANTINE)
|
|
@quarantinesupport@ if string match -r '^[A-Za-z_][A-Za-z0-9_]*$' $_mlv >/dev/null
|
|
@quarantinesupport@ if set -q $_mlv
|
|
@quarantinesupport@ set _mlre $_mlre$_mlv"_modquar='$$_mlv' "
|
|
@quarantinesupport@ end
|
|
@quarantinesupport@ set _mlrv "MODULES_RUNENV_$_mlv"
|
|
@quarantinesupport@ set _mlre "$_mlre$_mlv='$$_mlrv' "
|
|
@quarantinesupport@ end
|
|
@quarantinesupport@end
|
|
@quarantinesupport@if [ -n "$_mlre" ]
|
|
@quarantinesupport@ set _mlre "env $_mlre"
|
|
@quarantinesupport@end
|
|
@quarantinesupport@
|
|
# define module command and surrounding initial environment (default value
|
|
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init/.modulespath)
|
|
@quarantinesupport@eval $_mlre @TCLSH@ @libexecdir@/modulecmd.tcl fish autoinit | source -
|
|
@notquarantinesupport@eval @TCLSH@ @libexecdir@/modulecmd.tcl fish autoinit | source -
|
|
|
|
@quarantinesupport@# clean temp variables used to setup quarantine
|
|
@quarantinesupport@set -e _mlre; set -e _mlv; set -e _mlrv;
|
|
@quarantinesupport@
|
|
if status -i
|
|
if [ -r @initdir@/fish_completion ]
|
|
source @initdir@/fish_completion
|
|
end
|
|
end
|
|
|
|
@compatversion@# no switchml definition since there is no Fish support in C version
|
|
@compatversion@
|
|
# setup ENV variables to get module defined in sub-shells (works for 'sh'
|
|
# and 'ksh' in interactive mode and 'sh' (zsh-compat), 'bash' and 'ksh'
|
|
# (zsh-compat) in non-interactive mode.
|
|
set -xg ENV @initdir@/profile.sh
|
|
set -xg BASH_ENV @initdir@/bash
|
|
|
|
@setbinpath@if not contains @bindir@ $PATH
|
|
@setbinpath@@prependbinpath@ set -xg PATH @bindir@ $PATH
|
|
@setbinpath@@appendbinpath@ set -xg PATH $PATH @bindir@
|
|
@setbinpath@end
|
|
@setbinpath@
|
|
@setmanpath@@usemanpath@set manpath (manpath ^/dev/null)
|
|
@setmanpath@@notusemanpath@set manpath $MANPATH
|
|
@setmanpath@if not string match -q '*:@mandir@:*' :$manpath:
|
|
@setmanpath@ if [ -z $manpath ]
|
|
@setmanpath@ set -xg MANPATH @mandir@
|
|
@setmanpath@ else
|
|
@setmanpath@@prependmanpath@ set -xg MANPATH @mandir@:$manpath
|
|
@setmanpath@@appendmanpath@ set -xg MANPATH $manpath:@mandir@
|
|
@setmanpath@ end
|
|
@setmanpath@end
|