mirror of
https://github.com/envmodules/modules.git
synced 2026-06-03 00:33:18 +08:00
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.
26 lines
989 B
Ruby
26 lines
989 B
Ruby
# define modules runtine quarantine configuration
|
|
@setquarvars@ENV['MODULES_RUN_QUARANTINE'] = '@RUN_QUARANTINE@'
|
|
@setquarvars@@ENV['RUNENV_VAR'] = 'RUNENV_VAL'@
|
|
@notsetquarvars@#ENV['MODULES_RUN_QUARANTINE'] = 'ENVVARNAME'
|
|
@notsetquarvars@
|
|
# setup quarantine if defined
|
|
_mlre = ''
|
|
if ENV.has_key?('MODULES_RUN_QUARANTINE') then
|
|
ENV['MODULES_RUN_QUARANTINE'].split(' ').each do |_mlv|
|
|
if _mlv =~ /^[A-Za-z_][A-Za-z0-9_]*$/ then
|
|
if ENV.has_key?(_mlv) then
|
|
_mlre << "__MODULES_QUAR_" + _mlv + "='" + ENV[_mlv].to_s + "' "
|
|
end
|
|
_mlrv = 'MODULES_RUNENV_' + _mlv
|
|
_mlre << _mlv + "='" + ENV[_mlrv].to_s + "' "
|
|
end
|
|
end
|
|
unless _mlre.empty?
|
|
_mlre = 'env ' + _mlre + '__MODULES_QUARANTINE_SET=1 '
|
|
end
|
|
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 ruby autoinit`
|