Files
modules/init/r.R.in
Xavier Delaruelle 5a33a474d5 Use initconf in etcdir rather initdir if it exists
Take into account Modules initialization configurations found in ``etc``
directory if they exist rather in ``init`` directory. If ``initrc``
configuration file is found in ``etcdir`` then it is preferred over
``modulerc`` file in ``initdir``. Following the same trend,
``modulespath`` configuration file is found in ``etcdir`` then it is
preferred over ``.modulespath`` file in ``initdir``.
2019-07-10 07:04:52 +02:00

29 lines
1.6 KiB
R

@quarantinesupport@# define modules runtine quarantine configuration
@quarantinesupport@@setquarvars@Sys.setenv('MODULES_RUN_QUARANTINE'='@RUN_QUARANTINE@')
@quarantinesupport@@setquarvars@@Sys.setenv('RUNENV_VAR'='RUNENV_VAL')@
@quarantinesupport@@notsetquarvars@#Sys.setenv('MODULES_RUN_QUARANTINE'='ENVVARNAME')
@quarantinesupport@@notsetquarvars@
@quarantinesupport@# setup quarantine if defined
@quarantinesupport@mlre <- ''
@quarantinesupport@if (!is.na(Sys.getenv('MODULES_RUN_QUARANTINE', unset=NA))) {
@quarantinesupport@ for (mlv in strsplit(Sys.getenv('MODULES_RUN_QUARANTINE'), ' ')[[1]]) {
@quarantinesupport@ if (grepl('^[A-Za-z_][A-Za-z0-9_]*$', mlv)) {
@quarantinesupport@ if (!is.na(Sys.getenv(mlv, unset=NA))) {
@quarantinesupport@ mlre <- paste0(mlre, mlv, "_modquar='", Sys.getenv(mlv), "' ")
@quarantinesupport@ }
@quarantinesupport@ mlrv <- paste0('MODULES_RUNENV_', mlv)
@quarantinesupport@ mlre <- paste0(mlre, mlv, "='", Sys.getenv(mlrv), "' ")
@quarantinesupport@ }
@quarantinesupport@ }
@quarantinesupport@ if (mlre != '') {
@quarantinesupport@ mlre <- paste0('env ', mlre)
@quarantinesupport@ }
@quarantinesupport@}
@quarantinesupport@
# define module command and surrounding initial environment (default value
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init config files)
@quarantinesupport@cmdpipe <- pipe(paste0(mlre, '@TCLSH@ @libexecdir@/modulecmd.tcl r autoinit'))
@notquarantinesupport@cmdpipe <- pipe(paste0('@TCLSH@ @libexecdir@/modulecmd.tcl r autoinit'))
eval(parse(cmdpipe))
close(cmdpipe)