Forum > Linux

[Solved] Differentiate between various Linux distros

<< < (2/5) > >>

petevick:

--- Quote from: Lutz Mändle on May 29, 2022, 06:29:37 pm ---Have a look at /etc/os-release, there is also a man page (man os-release).

--- End quote ---
Thanks for this Lutz, but I think the solution from howardpc will be a tad more straight forward as 'issue' is just a one line text file.

petevick:

--- Quote from: howardpc on May 29, 2022, 06:39:24 pm ---
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses  FileUtil; function GetLinuxDistro: String;const  Issue = '/etc/issue';begin  case FileExists(Issue) of    True:  Result := ReadFileToString(Issue);    False: Result := 'unknown distro';  end;end;     

--- End quote ---
Thanks for this, It should work for me.

Kays:

--- Quote from: Lutz Mändle on May 29, 2022, 06:29:37 pm ---Have a look at /etc/os-release, there is also a man page (man os-release).
--- End quote ---
Right. Everything’s runnin’ on systemd nowadays.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  OSVersion := 'systemd';

MarkMLl:

--- Quote from: petevick on May 29, 2022, 06:49:22 pm ---
--- Quote from: Lutz Mändle on May 29, 2022, 06:29:37 pm ---Have a look at /etc/os-release, there is also a man page (man os-release).

--- End quote ---
Thanks for this Lutz, but I think the solution from howardpc will be a tad more straight forward as 'issue' is just a one line text file.

--- End quote ---

I believe /etc/os-release is the nearest thing you'll get to a correct answer since this is officially sanctioned by both linux.org and freedesktop.org: hence you will also find it supported by Solaris etc., with standardised content.

Anything using conditional compilation is doomed to failure, since all you're doing is asking the build environment what it thinks it's compiling for. So as a specific example, you might be building a 32-bit Linux program with no GUI which is going to be run on a 64-bit distro with KDE.

Conditionals do have their uses, but what you're trying to do isn't one of them :-)

MarkMLl

winni:

--- Quote from: Kays on May 29, 2022, 07:05:45 pm ---
--- Quote from: Lutz Mändle on May 29, 2022, 06:29:37 pm ---Have a look at /etc/os-release, there is also a man page (man os-release).
--- End quote ---
Right. Everything’s runnin’ on systemd nowadays.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  OSVersion := 'systemd';
--- End quote ---

Hi!

This is not correct.

There is a hardcore crew that is angry about systemd.

Have a look at

https://nosystemd.org/

Winni

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version