Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 388597 - sys-apps/baselayout: include /etc/os-release file
Summary: sys-apps/baselayout: include /etc/os-release file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 405547 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-26 18:39 UTC by Michał Górny
Modified: 2013-04-23 14:24 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-10-26 18:39:11 UTC
/etc/os-release is another file introduced by systemd to make getting system release information easier. I can put that file into systemd ebuild but maybe putting it in baselayout would make it useful for more users (scripts).

Difference from lsb_release: doesn't require running shell script to get the information portably, the /etc/os-release file is guaranteed to be simple shell-like file which can be either sourced or parsed easily.

Jorge suggested we should also think about providing a version number. He suggested using baselayout version like in /etc/gentoo-release -- which would as well make the file more suitable for baselayout ebuild.

An example file would look like:

NAME="Gentoo Linux" # maybe without Linux?
VERSION=2.1 # or "Base System release 2.1"?
ID=gentoo
VERSION_ID=2.1
PRETTY_NAME="Gentoo Base System release 2.1"
ANSI_COLOR=1;32

Shortly:
- NAME and VERSION are supposed to be full, human-readable,
- ID and VERSION_ID short, simple, machine-parseable,
- PRETTY_NAME as it suggests,
- ANSI_COLOR specifies the color to use when printing the above.
Comment 1 SpanKY gentoo-dev 2011-10-26 20:39:41 UTC
not sure about this.  if we did merge it, i think we'd want gentoo-release to either not exist or symlink it in.

it would help if Fedora wasn't the only one adopting this ...
Comment 2 Doug Goldstein (RETIRED) gentoo-dev 2011-10-26 21:49:50 UTC
I'm still not understanding the point or the improvement over /etc/lsb-release. People keep mentioning to me that it doesn't require a shell to parse, but every distro I've checked the layout is..

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"

That being said, I really don't think we could scrap /etc/lsb-release, we MIGHT be able to scrap /etc/gentoo-release but we'd need to move the necessary info into /etc/lsb-release as well since when the DISTRIB_DESCRIPTION field is missing it will read the /etc/${DISTRIB_ID-release file.

And lastly, to not divert the discussion, what are you doing about the /etc/machine-id file that systemd needs?
Comment 3 Doug Goldstein (RETIRED) gentoo-dev 2011-10-26 22:01:46 UTC
I've asked the systemd guys to support using /etc/lsb-release but I've been met with absurdity.
Comment 4 SpanKY gentoo-dev 2011-10-26 22:28:11 UTC
baselayout doesn't install lsb-release.  i don't know what does under Gentoo.

as for talking to systemd upstream, i don't expect any reasonable response from them ever.  i don't see how os-release is any simpler than lsb-release, but i can't get the spec to check as LF is still down in many ways.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-10-26 23:01:47 UTC
(In reply to comment #4)
> baselayout doesn't install lsb-release.  i don't know what does under Gentoo.
sys-apps/lsb-release
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-10-27 05:38:58 UTC
(In reply to comment #2)
> I'm still not understanding the point or the improvement over /etc/lsb-release.
> People keep mentioning to me that it doesn't require a shell to parse, but
> every distro I've checked the layout is..

The 'lsb_release' script contains distro-specific hacks, and by the spec you're supposed to use it rather than /etc/lsb-release directly.

> And lastly, to not divert the discussion, what are you doing about the
> /etc/machine-id file that systemd needs?

D-Bus is using that location as well, so its ebuild just moves machine-id there.
Comment 7 Doug Goldstein (RETIRED) gentoo-dev 2011-10-27 18:17:39 UTC
For details on the two files, see:

http://0pointer.de/public/systemd-man/os-release.html
http://linux.die.net/man/1/lsb_release

While the lsb_release application does do some lifting, you'll see that the man page defines very similar fields to os-release.
Comment 8 Doug Goldstein (RETIRED) gentoo-dev 2011-10-27 18:23:01 UTC
(In reply to comment #6)
> (In reply to comment #2)
> > I'm still not understanding the point or the improvement over /etc/lsb-release.
> > People keep mentioning to me that it doesn't require a shell to parse, but
> > every distro I've checked the layout is..
> 
> The 'lsb_release' script contains distro-specific hacks, and by the spec you're
> supposed to use it rather than /etc/lsb-release directly.
> 

The script contains distro specific hacks only to deal with distros that don't ship /etc/lsb-release and to handle their funkiness. Look at it, its trying to work out the differences between /etc/redhat-release and /etc/debian_release into something consistent. We're shipping /etc/lsb-release, however we're not fully populating it which I would argue we should. To properly populate it we also may want to consider moving it to baselayout.

DISTRIB_ID=Gentoo
DISTRIB_RELEASE=2.1
DISTRIB_DESCRIPTION="Gentoo Base System release 2.1"
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-10-28 16:08:25 UTC
Well, I think we should ship one of two files.

If we decide to ship lsb-release only, someone should convince systemd upstream to support the file as well. Very unlikely to succeed. But I'll probably create a small fsnotify-activated unit which will update os-release on lsb-release changes.

If we decide to ship os-release only, we could make lsb_release script support that file as well. That would still fit the spec, and I think that its upstream will be more friendly to us.
Comment 10 SpanKY gentoo-dev 2012-01-14 10:54:09 UTC
at this point, i'm indifferent.  /etc/gentoo-release has largely been a useless marker, so picking a different useless marker doesn't matter to me too much.

vid=$(date +%Y.%m)
cat <<-EOF > "${D}"/etc/os-release
NAME=Gentoo
VERSION="${vid} Larry"
ID=gentoo
VERSION_ID=${vid}
PRETTY_NAME="Gentoo"
ANSI_COLOR=1;32
EOF
Comment 11 Jonathan Callen (RETIRED) gentoo-dev 2012-02-14 00:23:41 UTC
Just my USD0.02: We should probably not include any version information in /etc/os-release at all (as Lennart suggests for rolling-release distros), so the resulting file might look like:

NAME=Gentoo
ID=gentoo
PRETTY_NAME=Gentoo
ANSI_COLOR=1;32

(Color of the bikeshed is up for debate as usual)
Comment 12 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-02-14 13:40:32 UTC
We should make it Gentoo Linux (or Gentoo FreeBSD etc) probably.
Comment 13 Samuli Suominen (RETIRED) gentoo-dev 2012-02-24 11:21:24 UTC
*** Bug 405547 has been marked as a duplicate of this bug. ***
Comment 14 Paul Tobias 2012-03-13 17:06:32 UTC
Here is a post about the /etc/os-release file addressing some questions asked in this bug too: http://0pointer.de/blog/projects/os-release.html
Comment 15 SpanKY gentoo-dev 2012-05-17 04:22:26 UTC
added Diego's suggestion for Gentoo/<OS>, and by dropping version info as suggested by Jonathan, there's no need to generate in the ebuild itself

http://sources.gentoo.org/baselayout?rev=3203&view=rev