mirror of
https://github.com/envmodules/modules.git
synced 2026-06-14 00:42:43 +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
42 lines
1.9 KiB
Perl
42 lines
1.9 KiB
Perl
@quarantinesupport@# define modules runtine quarantine configuration
|
|
@quarantinesupport@@setquarvars@$ENV{'MODULES_RUN_QUARANTINE'} = '@RUN_QUARANTINE@';
|
|
@quarantinesupport@@setquarvars@@$ENV{'RUNENV_VAR'} = 'RUNENV_VAL';@
|
|
@quarantinesupport@@notsetquarvars@#$ENV{'MODULES_RUN_QUARANTINE'} = 'ENVVARNAME';
|
|
@quarantinesupport@@notsetquarvars@
|
|
@quarantinesupport@# setup quarantine if defined
|
|
@quarantinesupport@my $_mlre = '';
|
|
@quarantinesupport@if (defined $ENV{'MODULES_RUN_QUARANTINE'}) {
|
|
@quarantinesupport@ foreach my $_mlv (split(' ', $ENV{'MODULES_RUN_QUARANTINE'})) {
|
|
@quarantinesupport@ if ($_mlv =~ /^[A-Za-z_][A-Za-z0-9_]*$/) {
|
|
@quarantinesupport@ if (defined $ENV{$_mlv}) {
|
|
@quarantinesupport@ $_mlre .= "${_mlv}_modquar='$ENV{$_mlv}' ";
|
|
@quarantinesupport@ }
|
|
@quarantinesupport@ my $_mlrv = "MODULES_RUNENV_$_mlv";
|
|
@quarantinesupport@ $_mlre .= "$_mlv='$ENV{$_mlrv}' ";
|
|
@quarantinesupport@ }
|
|
@quarantinesupport@ }
|
|
@quarantinesupport@ if ($_mlre ne "") {
|
|
@quarantinesupport@ $_mlre = "env $_mlre";
|
|
@quarantinesupport@ }
|
|
@quarantinesupport@}
|
|
@quarantinesupport@
|
|
@quarantinesupport@eval `${_mlre}@TCLSH@ @libexecdir@/modulecmd.tcl perl autoinit`;
|
|
@notquarantinesupport@eval `@TCLSH@ @libexecdir@/modulecmd.tcl perl autoinit`;
|
|
|
|
@quarantinesupport@# clean temp variable used to setup quarantine
|
|
@quarantinesupport@undef $_mlre;
|
|
@quarantinesupport@
|
|
@compatversion@# redefine module command if compat version has been activated
|
|
@compatversion@if ($ENV{'MODULES_USE_COMPAT_VERSION'} eq '1') {
|
|
@compatversion@ $ENV{'MODULES_CMD'} = '@libexecdir@/modulecmd-compat';
|
|
@compatversion@ { no warnings 'redefine';
|
|
@compatversion@ *module = sub {
|
|
@compatversion@ eval `@libexecdir@/modulecmd-compat perl @_`;
|
|
@compatversion@ # return value as done on new main version
|
|
@compatversion@ return 1;
|
|
@compatversion@ };
|
|
@compatversion@ }
|
|
@compatversion@}
|
|
@compatversion@
|
|
1;
|