[RFC] Operating system name/version detection
Thiago Macieira
thiago at macieira.org
Thu Apr 10 14:25:45 PDT 2014
Em qui 10 abr 2014, às 22:31:34, Lubomir I. Ivanov escreveu:
> for debian based this should be done:
> int fd = QT_OPEN("/etc/lsb-release", O_RDONLY);
I've just checked with a Debian maintainer: /etc/os-release exists on stable,
but not on older versions.
I will probably have to write a fallback to /etc/lsb-release. However, note
that the file does not exist unless you've installed the LSB support package,
which isn't the case for everyone.
> in general a file /etc/*-release should contain this extra bit of
> information. but note there is different formatting in these files
> (ughh...), e.g : DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=12.04
> DISTRIB_CODENAME=precise
> DISTRIB_DESCRIPTION="Ubuntu 12.04.1 LTS"
I'm loathe to start scanning /etc for the version. That's why /etc/os-release
is important.
If that file is not found, the version will be detected as "linux_<kernel-
version-here>".
>
> and these search strings will not work:
> static const char idString[] = "NAME=";
> static const char prettyNameString[] = "PRETTY_NAME=";
> static const char versionIdString[] = "VERSION=";
>
> ^ BTW, there is no need to include "String" in the variable name since
> char[] makes that obvious.
The naming comes from me.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
More information about the subsurface
mailing list