On Thu, 26 Aug 2021, Alexander Kanavin wrote:

> It used to be that 'exit 1' was the way to defer to boot time, but
> that was changed long time ago to not be ambiguous like that and
> cause a real failure at build time. Deferring to first boot needs to
> be explicitly requested with _ontarget() (you can read the
> definition for it to see what really happens, how $D is used and how
> request to defer is made).
>
> Alex
>
> On Wed, 25 Aug 2021 at 23:51, Robert P. J. Day <[email protected]> wrote:
>
>       Quoting Phil Blundell <[email protected]>:
>
>       > That's testing for offline installation. If $D is not set, it's 
>       > running on the target.
>       >
>       > p.
>
>          one last query before i head off for dinner ... so what about
>       pkg_postinst() routines that do double duty, like this one from
>       dbus_1.12.20.bb:
>
>
>       PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd 
>       sysvinit','systemd-systemctl-native','',d)}"
>       pkg_postinst:dbus() {
>                # If both systemd and sysvinit are enabled, mask the dbus-1 
>       init script
>                if ${@bb.utils.contains('DISTRO_FEATURES','systemd 
>       sysvinit','true','false',d)}; then
>                        if [ -n "$D" ]; then
>                                OPTS="--root=$D"
>                        fi
>                        systemctl $OPTS mask dbus-1.service
>                fi
>
>                if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; 
> then
>                        /etc/init.d/populate-volatile.sh update
>                fi
>       }

  so, just to confirm the previous tidbits of information (thank you
for your patience), here's my current understanding so i can submit
updated docs:

* pkg_postinst:${PN} is run at image creation time and *only* at image
  creation time; it is no longer deferred to boot time under any
  circumstances(?)

* pkg_postinst_ontarget:${PN} is run at boot time and *only* at boot
  time

* because of the above, there is no value to the numerous legacy
checks of:

  if [ -z "$D" ]
  if [ -n "$D" ]

  or any of its variations (even though, in a lot of cases, they don't
hurt)

* from within pkg_postinst:${PN}, you can still defer some work to
  boot time with "postinst_intercept delay_to_first_boot", although
  isn't this precisely what pkg_postinst_ontarget:${PN} is for, so is
  this postinst_intercept construct still useful?

* PACKAGE_WRITE_DEPS is still necessary to identify non-standard
native tools you might need for any pkg_postinst:${PN} processing

  does all that look about right?

rday
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#155339): 
https://lists.openembedded.org/g/openembedded-core/message/155339
Mute This Topic: https://lists.openembedded.org/mt/85146007/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to