* Re: stupid question about post-installation scripts
2013-11-25 15:21 ` FW: stupid question about post-installation scripts Rifenbark, Scott M
@ 2013-11-25 15:56 ` Bryan Evenson
2013-11-25 17:29 ` Robert P. J. Day
2013-11-25 17:01 ` FW: " Paul Eggleton
1 sibling, 1 reply; 6+ messages in thread
From: Bryan Evenson @ 2013-11-25 15:56 UTC (permalink / raw)
To: Rifenbark, Scott M, Robert P. J. Day; +Cc: Yocto discussion list
Robert,
That's how it works in my experience. I have some packages for my system that have a postinst piece that needs to run during image creation, and other pieces that need to run only on a package upgrade. By checking whether "x${D}" = "${D}", I am filtering out whether the postinst script is running during image creation or on the actual hardware. Been working great so far.
-Bryan
> -----Original Message-----
> From: yocto-bounces@yoctoproject.org [mailto:yocto-
> bounces@yoctoproject.org] On Behalf Of Rifenbark, Scott M
> Sent: Monday, November 25, 2013 10:22 AM
> To: Robert P. J. Day
> Cc: Yocto discussion list
> Subject: [yocto] FW: stupid question about post-installation scripts
>
> Robert,
>
> I don't know... I am forwarding to the discussion list.
>
> Scott
>
> >-----Original Message-----
> >From: Robert P. J. Day [mailto:rpjday@crashcourse.ca]
> >Sent: Sunday, November 24, 2013 2:37 AM
> >To: Rifenbark, Scott M
> >Subject: stupid question about post-installation scripts
> >
> >
> > when one defines pkg_postinst scripts, are those scripts invoked at
> >*both* root filesystem creation time and first boot time? so that one
> >needs to manually check the value of ${D} to decide whether to run
> >them, say, at first boot time?
> >
> > i'm reading the section here:
> >
> >http://www.yoctoproject.org/docs/latest/dev-manual/dev-
> >manual.html#post-installation-scripts
> >
> >and i know i've seen elsewhere scripts explicitly checking the value
> of
> >the ${D} prefix to determine when they're being invoked. it *seems*
> >like that's what's happening, but if that's the case, it can probably
> be said much more clearly.
> >
> >rday
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: stupid question about post-installation scripts
2013-11-25 15:56 ` Bryan Evenson
@ 2013-11-25 17:29 ` Robert P. J. Day
2013-11-25 17:41 ` Bryan Evenson
0 siblings, 1 reply; 6+ messages in thread
From: Robert P. J. Day @ 2013-11-25 17:29 UTC (permalink / raw)
To: Bryan Evenson; +Cc: Yocto discussion list
On Mon, 25 Nov 2013, Bryan Evenson wrote:
> Robert,
>
> That's how it works in my experience. I have some packages for my
> system that have a postinst piece that needs to run during image
> creation, and other pieces that need to run only on a package
> upgrade. By checking whether "x${D}" = "${D}", I am filtering out
> whether the postinst script is running during image creation or on
> the actual hardware. Been working great so far.
right, but what i was trying to clarify is (and i think you answer
it) that postint scripts will be invoked *both* at image creation time
and boot time, and it's your responsibility to identify which parts
run at which times.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: stupid question about post-installation scripts
2013-11-25 17:29 ` Robert P. J. Day
@ 2013-11-25 17:41 ` Bryan Evenson
0 siblings, 0 replies; 6+ messages in thread
From: Bryan Evenson @ 2013-11-25 17:41 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: Yocto discussion list
Robert,
> -----Original Message-----
> From: Robert P. J. Day [mailto:rpjday@crashcourse.ca]
> Sent: Monday, November 25, 2013 12:29 PM
> To: Bryan Evenson
> Cc: Rifenbark, Scott M; Yocto discussion list
> Subject: RE: stupid question about post-installation scripts
>
> On Mon, 25 Nov 2013, Bryan Evenson wrote:
>
> > Robert,
> >
> > That's how it works in my experience. I have some packages for my
> > system that have a postinst piece that needs to run during image
> > creation, and other pieces that need to run only on a package
> upgrade.
> > By checking whether "x${D}" = "${D}", I am filtering out whether the
> > postinst script is running during image creation or on the actual
> > hardware. Been working great so far.
>
> right, but what i was trying to clarify is (and i think you answer
> it) that postint scripts will be invoked *both* at image creation time
> and boot time, and it's your responsibility to identify which parts run
> at which times.
Everyone else please correct me if I'm wrong, but I believe that the package management tool checks if postinst completed successfully. The postinst script for a package can run either 1) during image creation, 2) during bootup or 3) during package installation/upgrade. If postinst for a package has not yet completed successfully, then the package management tool will try to run the postinst script for that package at the next triggerable event.
-Bryan
>
> rday
>
> --
>
> =======================================================================
> =
> Robert P. J. Day Ottawa, Ontario,
> CANADA
> http://crashcourse.ca
>
> Twitter:
> http://twitter.com/rpjday
> LinkedIn:
> http://ca.linkedin.com/in/rpjday
> =======================================================================
> =
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: FW: stupid question about post-installation scripts
2013-11-25 15:21 ` FW: stupid question about post-installation scripts Rifenbark, Scott M
2013-11-25 15:56 ` Bryan Evenson
@ 2013-11-25 17:01 ` Paul Eggleton
2013-11-25 17:06 ` Paul Eggleton
1 sibling, 1 reply; 6+ messages in thread
From: Paul Eggleton @ 2013-11-25 17:01 UTC (permalink / raw)
To: Rifenbark, Scott M, Robert P. J. Day; +Cc: yocto
On Monday 25 November 2013 15:21:41 Rifenbark, Scott M wrote:
> >From: Robert P. J. Day [mailto:rpjday@crashcourse.ca]
> >Sent: Sunday, November 24, 2013 2:37 AM
> >To: Rifenbark, Scott M
> >Subject: stupid question about post-installation scripts
> >
> > when one defines pkg_postinst scripts, are those scripts invoked at
> >
> >*both* root filesystem creation time and first boot time? so that one needs
> >to manually check the value of ${D} to decide whether to run them, say, at
> >first boot time?
Not both - it's either-or; i.e. it will be run at rootfs creation time and if
it fails then, it will be run on first boot. Yes you can use the value of $D
(note: *not* ${D}!) to find out where the script is being called from, if
necessary.
> > i'm reading the section here:
> >http://www.yoctoproject.org/docs/latest/dev-manual/dev-> >manual.html#post-installation-scripts
> >
> >and i know i've seen elsewhere scripts explicitly checking the value of the
> >${D} prefix to determine when they're being invoked. it *seems* like
> >that's what's happening, but if that's the case, it can probably be said
> >much more clearly.
The answer is, you can do this if you have to, but ideally you shouldn't need
to. In the ideal situation the script should be written such that it functions
equally well no matter where it executes; that avoids the need to run anything
on first boot, *and* (assuming you have package management enabled for the
target) it will work if the package is installed on the target some time
afterwards.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: FW: stupid question about post-installation scripts
2013-11-25 17:01 ` FW: " Paul Eggleton
@ 2013-11-25 17:06 ` Paul Eggleton
0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2013-11-25 17:06 UTC (permalink / raw)
To: Rifenbark, Scott M, Robert P. J. Day; +Cc: yocto
On Monday 25 November 2013 17:01:10 Paul Eggleton wrote:
> On Monday 25 November 2013 15:21:41 Rifenbark, Scott M wrote:
> > >From: Robert P. J. Day [mailto:rpjday@crashcourse.ca]
> > >Sent: Sunday, November 24, 2013 2:37 AM
> > >To: Rifenbark, Scott M
> > >Subject: stupid question about post-installation scripts
> > >
> > > when one defines pkg_postinst scripts, are those scripts invoked at
> > >
> > >*both* root filesystem creation time and first boot time? so that one
> > >needs
> > >to manually check the value of ${D} to decide whether to run them, say,
> > >at
> > >first boot time?
>
> Not both - it's either-or; i.e. it will be run at rootfs creation time and
> if it fails then, it will be run on first boot. Yes you can use the value
> of $D (note: *not* ${D}!) to find out where the script is being called
> from, if necessary.
PS, if you really do want to force the script to be postponed until first boot,
you *must* make the postinst script fail if $D has a value - if you just let
it pass the system will assume it doesn't need to be called again on first
boot.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 6+ messages in thread