diff options
-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 | } | ||