[OE-core] [PATCH 4/4] base-files: create typical merged /usr symlinks if the "merged-usr" distro feature is set

Matthias Schiffer mschiffer at universe-factory.net
Wed Dec 16 18:12:00 UTC 2015


The typical symlinks are:

* /bin -> usr/bin
* /sbin -> usr/sbin
* /lib -> usr/lib
* /usr/sbin -> bin

It is checked that only sane symlinks are created, so a half-merged /usr
(e.g, merging bin and sbin, but not lib) is feasible as well.

The following options in a distro configuration create a full Fedora-style
merged /usr:

  DISTRO_FEATURES_DEFAULT += "merged-usr"
  base_bindir = "${exec_prefix}/bin"
  base_sbindir = "${exec_prefix}/bin"
  sbindir = "${exec_prefix}/bin"
  base_libdir = "${exec_prefix}/${baselib}"
  nonarch_base_libdir = "${exec_prefix}/lib"

[YOCTO #7040]

Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 meta/recipes-core/base-files/base-files_3.0.14.bb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index 0c1171f..852f4f5 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -134,6 +134,28 @@ do_install () {
 	fi
 
 	ln -sf /proc/mounts ${D}${sysconfdir}/mtab
+
+	if ${@bb.utils.contains('DISTRO_FEATURES','merged-usr','true','false',d)}; then
+		if [ "${base_bindir}" != "/bin" ]; then
+			ln -snf "${@d.getVar('base_bindir', True)[1:]}" ${D}/bin
+		fi
+
+		if [ "${base_sbindir}" != "/sbin"  ]; then
+			ln -snf "${@d.getVar('base_sbindir', True)[1:]}" ${D}/sbin
+		fi
+
+		if [ "${nonarch_base_libdir}" != "/lib" ]; then
+			ln -snf "${@d.getVar('nonarch_base_libdir', True)[1:]}" ${D}/lib
+		fi
+
+		if [ "${base_libdir}" != "/${baselib}" ]; then
+			ln -snf "${@d.getVar('base_libdir', True)[1:]}" ${D}/${baselib}
+		fi
+
+		if [ "${bindir}" = "${exec_prefix}/bin" -a "${sbindir}" = "${exec_prefix}/bin" ]; then
+			ln -snf bin ${D}${exec_prefix}/sbin
+		fi
+	fi
 }
 
 DISTRO_VERSION[vardepsexclude] += "DATE"
-- 
2.6.4




More information about the Openembedded-core mailing list