Frank,
Distro-detection and distro-specific code inside individual modulefiles would be repetitive and fragile, and would quickly become difficult to maintain. For a multi-distro system here, I use several modulefile trees, presenting distro-specific trees before shared ones:
$ echo $MODULEPATH
/opt/apps/M/el6:/opt/apps/M/el:/usr/share/Modules/modulefiles:/etc/modulefiles
To add to what Paul just wrote, lsb_release(1) is provided on CentOS by package redhat-lsb-core. As part of scripts in /etc/profile.d/, I use:
$ lsb_release -sir
CentOS 6.9
Has a nice ring to it and is easy to parse.
With best regards,
Michael
> On 2017-08-03, at 12:53 , Frank Thommen <f.t...@dk...> wrote:
> 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
|