summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/os-release/os-release.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/os-release/os-release.bb')
-rw-r--r--meta/recipes-core/os-release/os-release.bb31
1 files changed, 28 insertions, 3 deletions
diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb
index a29d678125..8906906bc3 100644
--- a/meta/recipes-core/os-release/os-release.bb
+++ b/meta/recipes-core/os-release/os-release.bb
@@ -2,6 +2,7 @@ inherit allarch
2 2
3SUMMARY = "Operating system identification" 3SUMMARY = "Operating system identification"
4DESCRIPTION = "The /usr/lib/os-release file contains operating system identification data." 4DESCRIPTION = "The /usr/lib/os-release file contains operating system identification data."
5HOMEPAGE = "https://www.freedesktop.org/software/systemd/man/os-release.html"
5LICENSE = "MIT" 6LICENSE = "MIT"
6INHIBIT_DEFAULT_DEPS = "1" 7INHIBIT_DEFAULT_DEPS = "1"
7 8
@@ -10,16 +11,35 @@ do_unpack[noexec] = "1"
10do_patch[noexec] = "1" 11do_patch[noexec] = "1"
11do_configure[noexec] = "1" 12do_configure[noexec] = "1"
12 13
14# See: https://www.freedesktop.org/software/systemd/man/os-release.html
13# Other valid fields: BUILD_ID ID_LIKE ANSI_COLOR CPE_NAME 15# Other valid fields: BUILD_ID ID_LIKE ANSI_COLOR CPE_NAME
14# HOME_URL SUPPORT_URL BUG_REPORT_URL 16# HOME_URL SUPPORT_URL BUG_REPORT_URL
15OS_RELEASE_FIELDS = "ID ID_LIKE NAME VERSION VERSION_ID PRETTY_NAME" 17OS_RELEASE_FIELDS = "\
18 ID ID_LIKE NAME VERSION VERSION_ID VERSION_CODENAME PRETTY_NAME \
19 CPE_NAME \
20"
16OS_RELEASE_UNQUOTED_FIELDS = "ID VERSION_ID VARIANT_ID" 21OS_RELEASE_UNQUOTED_FIELDS = "ID VERSION_ID VARIANT_ID"
17 22
18ID = "${DISTRO}" 23ID = "${DISTRO}"
19NAME = "${DISTRO_NAME}" 24NAME = "${DISTRO_NAME}"
20VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}" 25VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}"
21VERSION_ID = "${DISTRO_VERSION}" 26VERSION_ID = "${DISTRO_VERSION}"
27VERSION_CODENAME = "${DISTRO_CODENAME}"
22PRETTY_NAME = "${DISTRO_NAME} ${VERSION}" 28PRETTY_NAME = "${DISTRO_NAME} ${VERSION}"
29
30# The vendor field is hardcoded to "openembedded" deliberately. We'd
31# advise developers leave it as this value to clearly identify the
32# underlying build environment from which the OS was constructed. We
33# understand people will want to identify themselves as the people who
34# built the image, we'd suggest using the DISTRO element to do this, so
35# that is customisable.
36# This end result combines to mean systems can be traced back to both who
37# built them and which system was used, which is ultimately the goal of
38# the CPE.
39
40CPE_DISTRO ??= "${DISTRO}"
41CPE_NAME="cpe:/o:openembedded:${CPE_DISTRO}:${VERSION_ID}"
42
23BUILD_ID ?= "${DATETIME}" 43BUILD_ID ?= "${DATETIME}"
24BUILD_ID[vardepsexclude] = "DATETIME" 44BUILD_ID[vardepsexclude] = "DATETIME"
25 45
@@ -47,7 +67,12 @@ do_compile[vardeps] += "${OS_RELEASE_FIELDS}"
47do_install () { 67do_install () {
48 install -d ${D}${nonarch_libdir} ${D}${sysconfdir} 68 install -d ${D}${nonarch_libdir} ${D}${sysconfdir}
49 install -m 0644 os-release ${D}${nonarch_libdir}/ 69 install -m 0644 os-release ${D}${nonarch_libdir}/
50 lnr ${D}${nonarch_libdir}/os-release ${D}${sysconfdir}/os-release 70 ln -rs ${D}${nonarch_libdir}/os-release ${D}${sysconfdir}/os-release
71 ln -rs ${D}${nonarch_libdir}/os-release ${D}${sysconfdir}/initrd-release
51} 72}
52 73
53FILES_${PN} += "${nonarch_libdir}/os-release" 74FILES:${PN} = "${sysconfdir}/os-release ${nonarch_libdir}/os-release"
75
76PACKAGES += "${PN}-initrd"
77FILES:${PN}-initrd = "${sysconfdir}/initrd-release"
78RDEPENDS:${PN}-initrd += "${PN}"