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
--
---------------------------------------------------------------------
The views and opinions expressed above are strictly
those of the author(s). The content of this message has
not been reviewed nor approved by any entity whatsoever.
I should not be considered an "AUTHORITY" on any subject.
---------------------------------------------------------------------
Paul FM Info: http://www.umn.edu/~paulfm/
---------------------------------------------------------------------
|