[PATCH 04/23] base-files: support merged /usr

Amarnath Valluri
2017-02-10T13:42:30Z

From: Joshua Lock <joshua.g.lock@intel.com>

When the usrmerge DISTRO_FEATURE is enabled don't create /bin, /lib{32,64}
and /sbin. Instead, link them to the equivalent directories in /usr

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
---
meta/recipes-core/base-files/base-files_3.0.14.bb | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)

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 d138005..9e2c0b7 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
@@ -32,8 +32,8 @@ INHIBIT_DEFAULT_DEPS = "1"
docdir_append = "/${P}"
dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
dirs2775 = ""
-dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
- ${sysconfdir}/skel /lib /mnt /proc ${ROOT_HOME} /run /sbin \
+dirs755 = "/boot /dev ${sysconfdir} ${sysconfdir}/default \
+ ${sysconfdir}/skel /mnt /proc ${ROOT_HOME} /run \
${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
${libdir} ${sbindir} ${datadir} \
${datadir}/common-licenses ${datadir}/dict ${infodir} \
@@ -42,8 +42,8 @@ dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
/sys ${localstatedir}/lib/misc ${localstatedir}/spool \
${localstatedir}/volatile \
${localstatedir}/volatile/log \
- /home ${prefix}/src ${localstatedir}/local \
- /media"
+ /home ${prefix}/src ${localstatedir}/local /media \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '', '/bin /lib /sbin', d)}"

dirs755-lsb = "/srv \
${prefix}/local ${prefix}/local/bin ${prefix}/local/games \
@@ -105,6 +105,21 @@ do_install () {
ln -sf volatile/$d ${D}${localstatedir}/$d
done

+ if [ "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '1', '0', d)}" = "1" ] ; then
+ lnr ${D}${base_bindir} ${D}/bin
+ lnr ${D}${base_sbindir} ${D}/sbin
+ lnr ${D}${base_libdir} ${D}/${baselib}
+ if [ "${baselib}" != "lib" ]; then
+ lnr ${D}${nonarch_base_libdir} ${D}/lib
+ fi
+ # create base links for multilibs
+ multi_libdirs="${@d.getVar('MULTILIB_VARIANTS')}"
+ for d in $multi_libdirs; do
+ install -m 0755 -d ${D}/${exec_prefix}/$d
+ lnr ${D}/${exec_prefix}/$d ${D}/$d
+ done
+ fi
+
ln -snf ../run ${D}${localstatedir}/run
ln -snf ../run/lock ${D}${localstatedir}/lock

--
2.7.4