In the initialization rc file (i.e., etc/initrc), you could write
modulefile code to adapt the definition of the modulepath to use depending
on the user name, for instance:
if {[module-info username] in {foo bar}} {
module use /d/e/f /a/b/c /g/h/i
} else {
module use /a/b/c /d/e/f /g/h/i
}
"module-info usergroups" [1] could also be used to base the condition on
group membership rather on user names.
Cheers,
Xavier
[1]
https://modules.readthedocs.io/en/latest/modulefile.html#mfcmd-module-info
Le jeu. 7 avr. 2022 à 19:11, Frank Thommen <f.t...@dk...> a
écrit :
> Thanks a lot. I finally found this in the documentation, too. I hadn't
> understood it at first reading but your mail made it clear to me. Maybe
> this - imho unexpected - behaviour could/should be emphasized in the
> documentation?
>
> I don't know about "collections" yet. I'll look that up in the
> documentation.
>
> In our case, due to certain special circumstances, we need /some/ users
> to prepend the - already configured - path to one of our modulefile
> directories to $MODULEPATH (ie. the idea was to modify
> "/a/b/c:/d/e/f:/g/h/i" into "/d/e/f:/a/b/c:/d/e/f:/g/h/i". I now
> realize that this doesn't work anyway, as a path already existing in
> $MODULEPATH is not added again :-(.
>
> I'll have to see if I can find a workaround.
>
> For the more general problem that I'm having with the configuration
> mechanics of modules I will open a separate thread.
>
> Cheers, Frank
>
>
>
> On 06.04.22 08:21, Xavier Delaruelle wrote:
> > The etc/modulespath and etc/initrc configuration files are evaluated
> > during Modules initialization only if MODULEPATH and LOADEDMODULES
> > environment variables are found unset or empty.
> >
> > When a module command is run, the ~/.modulerc file is evaluated. It
> > happens also for the autoinit command, which is run to initialize
> Modules.
> >
> > So in your situation, during the initialization of Modules, MODULEPATH
> > is defined by ~/.modulerc commands, so the etc/modulespath file is not
> > processed.
> >
> > I would recommend not to set MODULEPATH in ~/.modulerc file
> > (etc/modulespath, etc/initrc or collection files should be preferred to
> > define the modulepaths). But one way to workaround this issue is to
> > update ~/.modulerc with the following code:
> >
> > $ cat ~/.modulerc
> > #%Module
> > if {![module-info command autoinit]} {
> > module use --append /a/b/c
> > append-path MODULEPATH /d/e/f
> > }
> >
> > Cheers,
> > Xavier
> >
> > Le mar. 5 avr. 2022 à 23:59, Frank Thommen <f.t...@dk...
> > <mailto:f.t...@dk...>> a écrit :
> >
> > they are defined in etc/modulespath. If I leave ~/.modulerc empty,
> > $MODULEPATH is $CENTRALLY_SET_MODULEPATHS
> >
> > On 05.04.22 17:45, Xav...@CE...
> > <mailto:Xav...@CE...> wrote:
> > > Hi Frank,
> > >
> > > Could you describe where and how the $CENTRALLY_SET_MODULEPATHS
> are
> > > defined ?
> > >
> > > Cheers,
> > > Xavier
> > >
> > >
> > > On Tue, 2022-04-05 at 17:28 +0200, Frank Thommen wrote:
> > >> Hi,
> > >>
> > >> this is most probably a silly error on my side, but I haven't
> found
> > >> the
> > >> solution: When having a custom ~/.modulerc with
> > >>
> > >> #%Module
> > >> module use --append /a/b/c
> > >> append-path MODULEPATH /d/e/f
> > >>
> > >> the resulting $MODULEPATH is "/a/b/c:/d/e/f". I would have
> > >> expected it
> > >> to be "$CENTRALLY_SET_MODULEPATHS:/a/b/c:/d/e/f". When only
> using
> > >> `append-path` it looks similar:
> > >>
> > >> #%Module
> > >> append-path MODULEPATH /d/e/f
> > >>
> > >> results in $MODULEPATH being "/d/e/f" instead of
> > >> "$CENTRALLY_SET_MODULEPATHS:/d/e/f".
> > >>
> > >> This is with Modules 5.0.1 on CentOS 7.9 systems. We have not
> > >> changed
> > >> any of the other configuration files after the installation other
> > >> than
> > >> populating etc/modulespath with our central modulefile repository
> > >> pathes.
> > >>
> > >> What have I overlooked?
> > >>
> > >> Cheers, Frank
> > >>
> > >
> > > _______________________________________________
> > > Modules-interest mailing list
> > > Mod...@li...
> > <mailto:Mod...@li...>
> > > https://lists.sourceforge.net/lists/listinfo/modules-interest
> > <https://lists.sourceforge.net/lists/listinfo/modules-interest>
> >
> >
> > _______________________________________________
> > Modules-interest mailing list
> > Mod...@li...
> > <mailto:Mod...@li...>
> > https://lists.sourceforge.net/lists/listinfo/modules-interest
> > <https://lists.sourceforge.net/lists/listinfo/modules-interest>
> >
> >
> >
> > _______________________________________________
> > Modules-interest mailing list
> > Mod...@li...
> > https://lists.sourceforge.net/lists/listinfo/modules-interest
>
>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
|