[CentOS-devel] /etc/redhat-release

Thu Jun 19 10:38:00 UTC 2014
Jimmy Kaplowitz <jkaplowitz at google.com>

On Jun 19, 2014 2:32 AM, "Miroslav Suchý" <msuchy at redhat.com> wrote:
>
> On 06/10/2014 05:19 PM, Fred Smith wrote:
> > What I'm not sure of is what would be a better way for an app installer
> > to find out which OS version it's being installed on. Can someone offer
> > me some enlightenment
>
> /etc/os-release
>
> http://www.freedesktop.org/software/systemd/man/os-release.html

If you use Python, its standard library has a pretty good platform module
for these kinds of things, which works even beyond Linux and even to
somewhat old versions of distros.

Features that are introduced by systemd can't be assumed as present except
on those (recent) Linux OS versions which are using systemd, and can almost
be assumed absent outside the Linux world (such as Solaris, BSD, Win/Mac).
A few non-systemd Linux distros do ship /etc/os-release, especially those
distro preparing to adopt systemd like Debian and Ubuntu - but even there
only in recent or unreleased versions.

By far the most portable platform detection system is know is GNU
autoconf's config.guess, but that may be overkill. :)

- Jimmy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos-devel/attachments/20140619/cae349cf/attachment-0007.html>