[OE-core] [PATCH][oe-core 1/4] sysstat: don't run populate-volatile.sh update in do_rootfs or without populate-volatile.sh

Martin Jansa martin.jansa at gmail.com
Fri Dec 2 00:24:17 UTC 2011


On Thu, Dec 01, 2011 at 01:41:46PM +0100, Martin Jansa wrote:
> On Thu, Dec 01, 2011 at 12:18:09PM +0000, Richard Purdie wrote:
> > On Thu, 2011-12-01 at 13:02 +0100, Martin Jansa wrote:
> > > Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
> > > ---
> > >  meta/recipes-extended/sysstat/sysstat.inc       |    7 ++++++-
> > >  meta/recipes-extended/sysstat/sysstat_10.0.2.bb |    2 +-
> > >  2 files changed, 7 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/meta/recipes-extended/sysstat/sysstat.inc b/meta/recipes-extended/sysstat/sysstat.inc
> > > index 2936f96..ca40ab5 100644
> > > --- a/meta/recipes-extended/sysstat/sysstat.inc
> > > +++ b/meta/recipes-extended/sysstat/sysstat.inc
> > > @@ -22,7 +22,12 @@ do_install() {
> > >  }
> > >  
> > >  pkg_postinst_${PN} () {
> > > -        /etc/init.d/populate-volatile.sh update
> > > +        if [ -n "$D" ]; then
> > > +                exit 1
> > > +        fi
> > 
> > I'm confused. Can't we exit 0 here since the system will have run
> > populate-volatile.sh update at rootfs time or first boot as needed so we
> > don't need to run it again?
> > 
> > See recipes-core/dbus/dbus.inc or pulseaudio for similar examples.
> 
> Ah I didn't know about importance of return value in this case and I was
> looking at 
> meta/classes/module.bbclass
> meta/recipes-connectivity/avahi/avahi.inc
> for similar examples.
> 
> I'll learn how it's changing behavior and why avahi has exit 1 in 2/3
> and exit 0 in 1/3 postinst and then I'll send updated patch if needed,
> but now I'm 5 hours late to daywork.. :).

Now after reading
3.1.6. Post Install Scripts
in manual
http://www.yoctoproject.org/docs/1.1/poky-ref-manual/poky-ref-manual.html#usingpoky-extend-addpkg-postinstalls

I'm confused too and wondering if dbus and pulseaudio are best examples..
dbus:
pkg_postinst_dbus() {
        if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
                /etc/init.d/populate-volatile.sh update
        fi
}

so it this will succeed every time in do_rootfs (even with test expression false), so it will be marked as installed 
and postinst won't be called on first boot, but will be called after every upgrade. Is that what we really want?

pulseaudio:
pkg_postinst_${PN}-server() {
        # can't do this offline
        if [ "x$D" != "x" ]; then
                exit 1
        fi

        if [ -e ${sysconfdir}/init.d/populate-volatile.sh ] ; then
            ${sysconfdir}/init.d/populate-volatile.sh update
        fi
}

this looks the same as my postinst in sysstat (only difference is '"x$D" != "x"' instead of shorter '-n "$D"')
and if I understand it right now, then this is better then what's in dbus.inc, because
during rootfs we maybe have /etc/init.d/populate-volatile.sh in $D but do we want to call 
/etc/init.d/populate-volatile.sh on host? Or does it automagically prepend $D to every path 
when it's executing postinst scripts in do_rootfs or does it some sort of chroot to $D?

Even if we prefix the path with $D in postinst like:
$D${sysconfdir}/init.d/populate-volatile.sh update
the populate-volatile.sh script has hardcoded paths like '/etc/volatile.cache' and '/etc/ld.so.cache'
inside, so it won't work very well when executed on host (without chrooting) and we should postpone it 
to be executed really on target and that's why we need 'exit 1'.

If I'm wrong please correct me and update "3.1.6. Post Install Scripts" to be more clear about this issues.

Cheers,

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20111202/78c6a503/attachment-0002.sig>


More information about the Openembedded-core mailing list