diff options
author | Sujith H <Sujith_Haridasan@mentor.com> | 2014-09-08 12:58:36 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-09-10 11:33:24 +0100 |
commit | b092e550b6313a89906368a10ed5b8b4f3a32bb6 (patch) | |
tree | d5514830ee8a9c7070799befec8630bd7f074c3e | |
parent | 7df591073e1ff3d8ad54d506bee5c2449ca67f7f (diff) | |
download | poky-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>
-rw-r--r-- | meta/recipes-core/os-release/os-release.bb | 36 |
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 @@ | |||
1 | inherit allarch | ||
2 | |||
3 | SUMMARY = "Operating system identification" | ||
4 | DESCRIPTION = "The /etc/os-release file contains operating system identification data." | ||
5 | LICENSE = "MIT" | ||
6 | INHIBIT_DEFAULT_DEPS = "1" | ||
7 | |||
8 | do_fetch[noexec] = "1" | ||
9 | do_unpack[noexec] = "1" | ||
10 | do_patch[noexec] = "1" | ||
11 | do_configure[noexec] = "1" | ||
12 | |||
13 | # Other valid fields: BUILD_ID ID_LIKE ANSI_COLOR CPE_NAME | ||
14 | # HOME_URL SUPPORT_URL BUG_REPORT_URL | ||
15 | OS_RELEASE_FIELDS = "ID ID_LIKE NAME VERSION VERSION_ID PRETTY_NAME" | ||
16 | |||
17 | ID = "${DISTRO}" | ||
18 | NAME = "${DISTRO_NAME}" | ||
19 | VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}" | ||
20 | VERSION_ID = "${DISTRO_VERSION}" | ||
21 | PRETTY_NAME = "${DISTRO_NAME} ${VERSION}" | ||
22 | BUILD_ID ?= "${DATETIME}" | ||
23 | |||
24 | python 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 | } | ||
31 | do_compile[vardeps] += "${OS_RELEASE_FIELDS}" | ||
32 | |||
33 | do_install () { | ||
34 | install -d ${D}${sysconfdir} | ||
35 | install -m 0644 os-release ${D}${sysconfdir}/ | ||
36 | } | ||