summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/os-release
diff options
context:
space:
mode:
authorSujith H <Sujith_Haridasan@mentor.com>2014-09-08 12:58:36 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-09-10 11:33:24 +0100
commitb092e550b6313a89906368a10ed5b8b4f3a32bb6 (patch)
treed5514830ee8a9c7070799befec8630bd7f074c3e /meta/recipes-core/os-release
parent7df591073e1ff3d8ad54d506bee5c2449ca67f7f (diff)
downloadpoky-b092e550b6313a89906368a10ed5b8b4f3a32bb6.tar.gz
os-release: Adding a new recipe for operating system identification
The /etc/os-release will have the operating system identification data. Tested on target with systemd enabled. Here is the sample file looks in the file: ID=poky-ivi-systemd NAME=Yocto GENIVI Baseline (Poky/meta-ivi) VERSION=6.0+snapshot-20140721 (daisy) VERSION_ID=6.0+snapshot-20140721 PRETTY_NAME=Yocto GENIVI Baseline (Poky/meta-ivi) 6.0+snapshot-20140721 (daisy) (From OE-Core rev: 8a12350e00b5443a24f3d6c7693fdde9fcb7319f) Signed-off-by: Christopher Larson <kergoth@gmail.com> Signed-off-by: Sujith H <Sujith_Haridasan@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/os-release')
-rw-r--r--meta/recipes-core/os-release/os-release.bb36
1 files changed, 36 insertions, 0 deletions
diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb
new file mode 100644
index 0000000000..33e958137f
--- /dev/null
+++ b/meta/recipes-core/os-release/os-release.bb
@@ -0,0 +1,36 @@
1inherit allarch
2
3SUMMARY = "Operating system identification"
4DESCRIPTION = "The /etc/os-release file contains operating system identification data."
5LICENSE = "MIT"
6INHIBIT_DEFAULT_DEPS = "1"
7
8do_fetch[noexec] = "1"
9do_unpack[noexec] = "1"
10do_patch[noexec] = "1"
11do_configure[noexec] = "1"
12
13# Other valid fields: BUILD_ID ID_LIKE ANSI_COLOR CPE_NAME
14# HOME_URL SUPPORT_URL BUG_REPORT_URL
15OS_RELEASE_FIELDS = "ID ID_LIKE NAME VERSION VERSION_ID PRETTY_NAME"
16
17ID = "${DISTRO}"
18NAME = "${DISTRO_NAME}"
19VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}"
20VERSION_ID = "${DISTRO_VERSION}"
21PRETTY_NAME = "${DISTRO_NAME} ${VERSION}"
22BUILD_ID ?= "${DATETIME}"
23
24python do_compile () {
25 with open(d.expand('${B}/os-release'), 'w') as f:
26 for field in d.getVar('OS_RELEASE_FIELDS', True).split():
27 value = d.getVar(field, True)
28 if value:
29 f.write('{0}={1}\n'.format(field, value))
30}
31do_compile[vardeps] += "${OS_RELEASE_FIELDS}"
32
33do_install () {
34 install -d ${D}${sysconfdir}
35 install -m 0644 os-release ${D}${sysconfdir}/
36}