Skip to contentSkip to conversation

stupid question about post-installation scripts

DISCUSSION Rifenbark, Scott M 4 participants 6 messages Nov 25, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.02.1311240533220.32547@oneiric

#1 lore raw

Robert,

I don't know... I am forwarding to the discussion list.

Scott

Quoted 22 lines

-----Original Message-----
From: Robert P. J. Day [mailto:[email protected]]
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

#2 lore raw

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

Quoted 42 lines

-----Original Message-----
From: [email protected] [mailto:yocto- [email protected]] 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

Quoted 12 lines

-----Original Message-----
From: Robert P. J. Day [mailto:[email protected]]
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?

Quoted 6 lines

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

Quoted 2 lines

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.

Quoted 2 lines

rday

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#3 lore raw
Quoted 8 lines · Bryan Evenson

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

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#4 lore raw

Robert,

Quoted 15 lines

-----Original Message-----
From: Robert P. J. Day [mailto:[email protected]]
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

Quoted 5 lines · Bryan Evenson

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.

Quoted 8 lines
Quoted 3 lines

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

Quoted 17 lines

rday

--

=======================================================================
=
Robert P. J. Day Ottawa, Ontario,
CANADA
http://crashcourse.ca

Twitter:
http://twitter.com/rpjday
LinkedIn:
http://ca.linkedin.com/in/rpjday
=======================================================================
=

#5 lore raw
In reply to Rifenbark, Scott M
Quoted 10 lines · Scott M
Quoted 10 lines

From: Robert P. J. Day [mailto:[email protected]]
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.

Quoted 7 lines
Quoted 7 lines

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

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#6 lore raw
Quoted 14 lines · On Monday 25 November 2013 17:01:10 Paul Eggleton wrote:
Quoted 5 lines · Scott M
Quoted 5 lines

From: Robert P. J. Day [mailto:[email protected]]
Sent: Sunday, November 24, 2013 2:37 AM
To: Rifenbark, Scott M
Subject: stupid question about post-installation scripts

Quoted 7 lines
Quoted 7 lines

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?

Quoted 4 lines

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

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre