It must be rocket science…

So I’m sitting here writing some generic “unhandled exception” code to display a dialog box in case Banshee throws up, as it’s better to have some kind of indication that it’s sick, than nothing at all. Along with the exception message and stack trace, I have it print the version information for all assemblies, and print the output of `uname -sirom` However one of the simplest, most useful pieces of platform information is the name and version of the distribution. Not the kernel version… the distribution release version. Like SuSE 10 Beta 3, or Ubuntu Breezy Preview Release 1, or Fedora Core 4. Something incredibly simple, yet meaningful. But how to find this out without doing some kind of insane file system fingerprinting or something else that is much more complicated than it should be?

Why isn’t there some simple static file, like /etc/distro, that contains a one line string of the distro name and version? Can it be too much to ask? Is there something simple that I’m missing? Am I the only developer that finds this information useful?

Actually, maybe some kind of Key=Value file, /etc/distro, could have more detailed, standard keys. Like Name=SuSE, Version=10.0, Release=Beta 3, Vendor=Novell, Kernel=Such and Such, etc., etc. Just so long as there’s some kind of standard distribution version file, with standard keys. I don’t care if it’s Key/Value, XML, Binary… just something with lots of useful information, that is standard across all distributions.

Oh well… the exception dialog rocks anyway.

13 Replies to “It must be rocket science…”

  1. Most Linux distributions do put some kind of versioning information into ‘/etc’ (Debian is ‘/etc/debian_version’, RedHat is ‘/etc/redhat-release’). The autoconf scripts for NetworkManager and Sabayon use them: look there for the correct filenames for some common distributions.

  2. In Mandriva we have /etc/mandriva-release, /etc/mandrake-release and /etc/mandrakelinux-release for backwards compatibility, and /etc/redhat-release for wider compatibility (it was in initial versions of MDK, people started using it in scripts, so we’ve kept it ever since in case people still are :>)

  3. I just checked, and on my Ubuntu Hoary system the /etc/lsb-release file has the info you want:

    $ cat /etc/lsb-release
    DISTRIB_DESCRIPTION=”Ubuntu (The Hoary Hedgehog Release)”

    The file /etc/debian_release also exists, but is significantly less informative:

    $ cat /etc/debian_version

  4. SuSE has /etc/lsb-release, but that just contains the kernel version. But it also has /etc/SuSE-release, which contains:

    SUSE LINUX 10.0 (i586) beta2
    VERSION = 10.0

    So these /etc/*-release files seem decently standard with regard to their location and general content, but the formats seem to vary, and some are more useful than others.

    It’d still be great to have some kind of unified standard for the contents and layout of say /etc/lsb-release.

    In the mean time, thanks for the tips… maybe I’ll end up throwing together some kind of parser – it’s better than nothing!

  5. And by “kernel version,” what I really meant the LSB_VERSION field, which is allegedly supposed to identify against which LSB release the distro is compatible with. At first I had only glanced at the filed and it resembled my kernel version :)

  6. /etc/issue is printed by getty before the login prompt. It should be a
    good indicator of the distribution and version of any UNIX-like

  7. You really want to use the lsb_release command, not base it off a file in /etc or something similar. Something along the lines of:

    : tfheen@thosu ~ > lsb_release -a
    LSB Version: n/a
    Distributor ID: Ubuntu
    Description: Ubuntu (The Breezy Badger Release) Development Branch
    Release: 5.10
    Codename: breezy

    should be enough, by far.

  8. I agree with using the lsb_release command is the best way for LSB 1.1
    compliant systems but /etc/issue is the best fall-back if that command
    is unavailable or parsing fails.

Comments are closed.