| Submitter | Laurentiu Palcu |
|---|---|
| Date | Sept. 19, 2012, 11:49 a.m. |
| Message ID | <949436f21dca1d0f73ff55f2692d8c1459657fa2.1348052899.git.laurentiu.palcu@intel.com> |
| Download | mbox | patch |
| Permalink | /patch/36909/ |
| State | New |
| Headers | show |
Comments
On 19 September 2012 12:49, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
> +ROOTFS_POSTPROCESS_COMMAND ?= "run_intercept_scriptlets"
From other examples, it looks like this should be "run_intercept_scriptlets;"
Also whilst this is a great proof of concept, maybe it should be
integrated into image.bblcass directly instead of being a postprocess
hook? A postprocess hook might expect the postinstall scripts to have
been ran already, which they would have been if they were not
intercepted.
Ross
On 09/19/2012 06:14 PM, Burton, Ross wrote: > On 19 September 2012 12:49, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote: >> +ROOTFS_POSTPROCESS_COMMAND ?= "run_intercept_scriptlets" > > From other examples, it looks like this should be "run_intercept_scriptlets;" Will do. My bad. > > Also whilst this is a great proof of concept, maybe it should be > integrated into image.bblcass directly instead of being a postprocess > hook? A postprocess hook might expect the postinstall scripts to have > been ran already, which they would have been if they were not > intercepted. I'm a little confused here... Technically, when the postprocess hooks are executed all the postinstall scripts were already executed. Ideally, the run-once scripts are created from inside the postinst scriptlets themselves. So, I don't really understand why using the postprocess hook isn't safe. Can you please elaborate? Thanks, Laurentiu > > Ross >
On 19 September 2012 16:45, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote: > I'm a little confused here... Technically, when the postprocess hooks > are executed all the postinstall scripts were already executed. Ideally, > the run-once scripts are created from inside the postinst scriptlets > themselves. So, I don't really understand why using the postprocess hook > isn't safe. Can you please elaborate? My concern (and it's just a hunch) is that there could be a post-process hook running before the intercepts are run which could be expecting the post install phase to have been completed. With intercepts a portion of the post-install phase is happening later than they previously did, so they haven't completely been ran yet. Ross
On 09/19/2012 06:50 PM, Burton, Ross wrote: > On 19 September 2012 16:45, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote: >> I'm a little confused here... Technically, when the postprocess hooks >> are executed all the postinstall scripts were already executed. Ideally, >> the run-once scripts are created from inside the postinst scriptlets >> themselves. So, I don't really understand why using the postprocess hook >> isn't safe. Can you please elaborate? > > My concern (and it's just a hunch) is that there could be a > post-process hook running before the intercepts are run which could be > expecting the post install phase to have been completed. With > intercepts a portion of the post-install phase is happening later than > they previously did, so they haven't completely been ran yet. I see your point now... The only place we could do it in image.bbclass is immediately after rootfs_${IMAGE_PKGTYPE}_do_rootfs in do_rootfs() function. But then we fall into the same issue you mentioned. The post-process hooks would be executed before the intercept scripts... The alternative would be to use the post-install hooks (ROOTFS_POSTINSTALL_COMMAND) instead of post-process. These are executed before the post-process hooks. Thanks, Laurentiu > > Ross >
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@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
Patch
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 + rootfs_${IMAGE_PKGTYPE}_do_rootfs insert_feed_uris
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@intel.com> --- meta/classes/image.bbclass | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)