[PATCH] os-release: add os-release-initrd package

Claudius Heine

When systemd is used inside an initramfs, it uses the presence of
`/etc/initrd-release` to detect when the system is in the initrd phase.
Otherwise `/etc/initrd-release` has the same format as

Add `os-release-initrd` package to provide `/etc/initrd-release` as a
symlink to the os-release file. To avoid adding this file to the
`os-release` package, explicitly only add `/etc/os-release` to the
`os-release` package.

Signed-off-by: Claudius Heine <ch@...>
meta/recipes-core/os-release/os-release.bb | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-co=
index 637d059e8b..caa2ed25aa 100644
--- a/meta/recipes-core/os-release/os-release.bb
+++ b/meta/recipes-core/os-release/os-release.bb
@@ -50,6 +50,11 @@ do_install () {
install -d ${D}${nonarch_libdir} ${D}${sysconfdir}
install -m 0644 os-release ${D}${nonarch_libdir}/
ln -rs ${D}${nonarch_libdir}/os-release ${D}${sysconfdir}/os-release
+ ln -rs ${D}${nonarch_libdir}/os-release ${D}${sysconfdir}/initrd-rel=
-FILES:${PN} +=3D "${nonarch_libdir}/os-release"
+FILES:${PN} =3D "${sysconfdir}/os-release ${nonarch_libdir}/os-release"
+PACKAGES +=3D "${PN}-initrd"
+FILES:${PN}-initrd =3D "${sysconfdir}/initrd-release"
+RDEPENDS:${PN}-initrd +=3D "${PN}"

Join openembedded-core@lists.openembedded.org to automatically receive all group messages.