While I see no problem with having a centralized file to get OS information from, I do have two issues with the file that's proposed here:
One is that I believe it shouldn't be in /etc which is generally used for configuration data, not for static distribution info. I'd put it somewhere in /usr/lib or /usr/share.
Second, I think that the linked documentation (http://www.freedesktop.org/software/systemd/man/os-release.h...) is incomplete in that it doesn't specify quoting behavior: The file doesn't say anything about when or if at all values need to be quoted but the has quotes on some string values (but not all) in the example.
Are the quotes part of the value and thus should be displayed? Or are quotes needed for values with spaces in them?
Yes. I'm nit-picking, but IF you have to start off a new standard, please be sufficiently precise in order to reduce the need for somebody else having to do the same a few years down the road.
Other possible questions: Do custom keys need to be uppercase? Can they contain spaces themselves? ANSI_COLOR is a nice idea, can we also have a background color? Are spaces allowed in front and after the = sign? Are spaces in front and after the = sign part of the key or value? Or are they to be ignored?
Maybe use a standard format like YAML or JSON or (god forbid) XML which already has things like this covered.
Yes. This is all really small stuff, but in the end it's this unspecified small stuff that causes everybody to implement their solution differently which in turn makes writing a parser needlessly hard (or even impossible if there are conflicting interpretations)
Comments
While I see no problem with having a centralized file to get OS information from, I do have two issues with the file that's proposed here:
One is that I believe it shouldn't be in /etc which is generally used for configuration data, not for static distribution info. I'd put it somewhere in /usr/lib or /usr/share.
Second, I think that the linked documentation (http://www.freedesktop.org/software/systemd/man/os-release.h...) is incomplete in that it doesn't specify quoting behavior: The file doesn't say anything about when or if at all values need to be quoted but the has quotes on some string values (but not all) in the example.
Are the quotes part of the value and thus should be displayed? Or are quotes needed for values with spaces in them?
Yes. I'm nit-picking, but IF you have to start off a new standard, please be sufficiently precise in order to reduce the need for somebody else having to do the same a few years down the road.
Other possible questions: Do custom keys need to be uppercase? Can they contain spaces themselves? ANSI_COLOR is a nice idea, can we also have a background color? Are spaces allowed in front and after the = sign? Are spaces in front and after the = sign part of the key or value? Or are they to be ignored?
Maybe use a standard format like YAML or JSON or (god forbid) XML which already has things like this covered.
Yes. This is all really small stuff, but in the end it's this unspecified small stuff that causes everybody to implement their solution differently which in turn makes writing a parser needlessly hard (or even impossible if there are conflicting interpretations)
There is already a bug report for your second issue:
https://bugs.freedesktop.org/show_bug.cgi?id=46021
The quoting, spacing and casing behaviour is defined here: "newline-separated list of shell-compatible variable assignments"
Unix shells have very well defined specifications.