That seems good idea, as I manage the central profile files in
/etc/profile.d where I could set "export DISTRO=..." and then have
somthing like the following in the modulefiles:
switch $env(DISTRO) {
"openSuse" {
set basepath /a/b/c
}
"CentOS" {
set basepath /x/y/z
}
}
(I got that from some Tcl tutorial page ;-)
and then continue with the distro specific $basepath.
I'll try that tomorrow.
Cheers 7 thanks
frank
On 08/03/2017 08:17 PM, Paul FM wrote:
> I would recommend that you somehow get the information you need in the
> exported user environment (possibly when their shell initializes, or
> with a module that your modules make sure is loaded).
> You can grab the output of a system command in tcl (read the tcl and
> tclsh man pages or online documentation).
>
> Then you can use TCL commands to get those environment variables in
> other modules.
>
> An alternative is to have a file in specific location that you preset
> with all the information about the machine, and then use TCL commands to
> parse it.
> Or if you want to just source the file in tcl, the contents might look
> something like this:
>
> set OS_NAME 'Linux'
> set OS_RELEASE '4.4.62-18.6-default'
> set OS_HW_PLATFORM 'x86_64'
> set OS_CPU 'x86_64'
> set OS_DIST_C 'SUSE'
> set OS_DIST 'openSUSE'
> set OS_DIST_R '42.2'
>
>
>
> One command that could help is:
> lsb-release
>
>
>
>
>
>
> On 8/3/2017 12:53 PM, Frank Thommen wrote:
>> Hi,
>>
>> I am currently trying to generalize our modulefiles so that the same
>> file can be used for different Linux distros. For historical reasons,
>> openSuSE and CentOS hosts @work have different base paths of their
>> respective software stack.
>>
>> Therefore my question: Is there a simple Tcl command that allows me to
>> detect the current Linux distribution or how could I detect it
>> otherwise? I can do it with bash, but I have no knowledge of Tcl
>> other than our very basic and simple modulefiles.
>>
>> Any hint is appreciated.
>>
>> Cheers
>> frank
>>
>> ------------------------------------------------------------------------------
>>
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Modules-interest mailing list
>> Mod...@li...
>> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
--
Frank Thommen | DKFZ Heidelberg / B080
| System Administrator
| f.t...@dk...
| MMK: +49-6221-42-3637 (Mo-Mi, Fr)
| IPMB: +49-6221-54-5823 (Do)
|