From afef7f063536d1e6519e425f654c986815f38a6a Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Wed, 30 Sep 2020 12:33:43 -0400 Subject: container-base: make CONTAINER_SHELL a conditional image install In some scenarios (and package managers), packages post install scripts may have references to /bin/sh. The package manager doesn't know if the scripts will run on the build host or target, so we get a calculated redepnds on /bin/sh base-files and base-passwd fall into this category of having post installs, but no need for /bin/sh on the target. If you know what you are installing, and want the smallest container possible, this package will satisfy the dependency when assembling the rootfs. To enable it, put the following in a configuration file (local.conf or otherwise): PACKAGE_EXTRA_ARCHS_append = " container-dummy-provides" This image will detect if the dummy provides arch is set, and will automatically install the providing recipe, otherwise, busybox is installed. If you have a custom shell or want a different behaviour, the CONTAINER_SHELL variable can be overriden. Signed-off-by: Bruce Ashfield --- recipes-extended/images/container-base.bb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/recipes-extended/images/container-base.bb b/recipes-extended/images/container-base.bb index 434239a8..acce0411 100644 --- a/recipes-extended/images/container-base.bb +++ b/recipes-extended/images/container-base.bb @@ -18,8 +18,20 @@ IMAGE_INSTALL = " \ base-files \ base-passwd \ netbase \ + ${CONTAINER_SHELL} \ " +# If the following is configured in local.conf (or the distro): +# PACKAGE_EXTRA_ARCHS_append = " container-dummy-provides" +# +# it has been explicitly # indicated that we don't want or need a shell, so we'll +# add the dummy provides. +# +# This is required, since there are postinstall scripts in base-files and base-passwd +# that reference /bin/sh and we'll get a rootfs error if there's no shell or no dummy +# provider. +CONTAINER_SHELL ?= "${@bb.utils.contains('PACKAGE_EXTRA_ARCHS', 'container-dummy-provides', 'container-dummy-provides', 'busybox', d)}" + # Allow build with or without a specific kernel IMAGE_CONTAINER_NO_DUMMY = "1" -- cgit v1.2.3-54-g00ecf