Finding about which OS is running via shell script
Tom H
tomh0665 at gmail.com
Sat Apr 27 19:01:47 UTC 2013
On Sat, Apr 27, 2013 at 10:05 AM, Paul Smith <paul at mad-scientist.net> wrote:
> On Sat, 2013-04-27 at 05:34 -0400, Tom H wrote:
>>
>> Except that you can have, for example, yum installed on Ubuntu or
>> apt-get installed on Fedora.
>
> In fact I do this all the time, because I'm cross-building packages for
> different distributions.
>
> The standard, approved way, as I wrote right at the beginning of the
> thread, is to use the lsb_release program. All other methods suggested
> here are just heuristics based on a limited set of distributions with no
> standardization. lsb_release is part of Linux Standard Base which,
> while not getting the love I wish it had, is still at least nominally
> adhered to by most every distribution.
"/etc/os-release" was created by the systemd developers [1]. Even
Ubuntu's got it and Steam uses it.
The distributions listed in the script posted earlier in this thread
all have either a "/etc/*release" or "/etc/*version" file, or both,
that can be parsed rather than use the lsb_release script. Fedora 18
doesn't install the latter by default.
[1] http://0pointer.de/blog/projects/os-release
More information about the ubuntu-users
mailing list