[OE-core] [RFC 2/7] image.bbclass: run postinst scripts once, at rootfs time
Richard Purdie
richard.purdie at linuxfoundation.org
Thu Sep 20 12:25:02 UTC 2012
On Wed, 2012-09-19 at 14:49 +0300, Laurentiu Palcu wrote:
> This patch will allow the repeating postinst scriptlets to be run
> only once, on host, at do_rootfs time. This will lower the time for
> rootfs generation and, also, instead of running some time consuming
> scriptlets at target's first boot, we will do on the host.
>
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu at intel.com>
> ---
> meta/classes/image.bbclass | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index ab212b3..4889260 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -155,7 +155,7 @@ inherit ${IMAGE_CLASSES}
>
> IMAGE_POSTPROCESS_COMMAND ?= ""
> MACHINE_POSTPROCESS_COMMAND ?= ""
> -ROOTFS_POSTPROCESS_COMMAND ?= ""
> +ROOTFS_POSTPROCESS_COMMAND ?= "run_intercept_scriptlets"
>
> # some default locales
> IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
> @@ -174,6 +174,21 @@ do_build[nostamp] = "1"
> # task, so that we have a single fakeroot context for the whole process.
> do_rootfs[umask] = "022"
>
> +
> +run_intercept_scriptlets () {
> + echo $D >> test.txt
> + if [ -d ${WORKDIR}/intercept_scripts ]; then
> + cd ${WORKDIR}/intercept_scripts
> + echo "Running intercept scripts:"
> + for script in *; do
> + if [ "$script" = "*" ]; then break; fi
> + echo "> Executing $script"
> + chmod +x $script
> + ./$script
> + done
> + fi
> +}
> +
> fakeroot do_rootfs () {
> #set -x
> # When use the rpm incremental image generation, don't remove the rootfs
> @@ -202,6 +217,13 @@ fakeroot do_rootfs () {
> done
> fi
>
> + if [ -d ${WORKDIR}/intercept_scripts ]; then
> + # clean-up old intercept scripts
> + rm -f ${WORKDIR}/intercept_scripts/*
> + else
> + mkdir ${WORKDIR}/intercept_scripts
> + fi
You can achieve this piece with:
do_rootfs[cleandirs] += "${WORKDIR}/intercept_scripts"
Cheers,
Richard
More information about the Openembedded-core
mailing list