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 <rpjday@crashcourse.ca> wrote:

Quoting Phil Blundell <pb@pbcl.net>:

> 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
}


note how that routine checks its context and, as i recall (but
it's not documented in the docs i'm looking at), i'd swear that
i read somewhere that if a pkg_postinst() routine fails at image
creation time, it was deferred until boot time, which would
explain the above routine checking its runtime context.

   anyway, off for food.

rday