1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

dev-manual: Updated the "Post-Installation Scripts" section.

Added a better, more up-to-date description of the way to defer
a post-installation script past the boot.

(From yocto-docs rev: 722b1b9c5bee1d43c45d943624854a53adc07939)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Scott Rifenbark
2018-11-13 10:29:59 -08:00
committed by Richard Purdie
parent 7ded3cc8cc
commit e8fb450ad5
@@ -3237,30 +3237,22 @@
post-installation script to be delayed until the first boot. post-installation script to be delayed until the first boot.
For example, the script might need to be executed on the For example, the script might need to be executed on the
device itself. device itself.
To delay script execution until boot time, use the following To delay script execution until boot time, you must explicitly
structure in the post-installation script: mark post installs to defer to the target.
<literallayout class='monospaced'> You can use <filename>pkg_postinst_ontarget()</filename> or
pkg_postinst_<replaceable>PACKAGENAME</replaceable>() { call
if [ x"$D" = "x" ]; then <filename>postinst-intercepts defer_to_first_boot</filename>
# Actions to carry out on the device go here from <filename>pkg_postinst()</filename>.
else Any failure of a <filename>pkg_postinst()</filename> script
exit 1 (including exit 1) triggers an error during the
fi <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-rootfs'><filename>do_rootfs</filename></ulink>
} task.
</literallayout>
</para> </para>
<para> <para>
The previous example delays execution until the image boots If you have recipes that use
again because the environment variable <filename>D</filename> <filename>pkg_postinst</filename> function
points to the directory containing the image when and they require the use of non-standard native
the root filesystem is created at build time but is unset
when executed on the first boot.
</para>
<para>
If you have recipes that use <filename>pkg_postinst</filename>
scripts and they require the use of non-standard native
tools that have dependencies during rootfs construction, you tools that have dependencies during rootfs construction, you
need to use the need to use the
<ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGE_WRITE_DEPS'><filename>PACKAGE_WRITE_DEPS</filename></ulink> <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGE_WRITE_DEPS'><filename>PACKAGE_WRITE_DEPS</filename></ulink>
@@ -3279,8 +3271,8 @@
<filename>pkg_prerm</filename>, and <filename>pkg_prerm</filename>, and
<filename>pkg_postrm</filename>, respectively. <filename>pkg_postrm</filename>, respectively.
These scrips work in exactly the same way as does These scrips work in exactly the same way as does
<filename>pkg_postinst</filename> with the exception that they <filename>pkg_postinst</filename> with the exception
run at different times. that they run at different times.
Also, because of when they run, they are not applicable to Also, because of when they run, they are not applicable to
being run at image creation time like being run at image creation time like
<filename>pkg_postinst</filename>. <filename>pkg_postinst</filename>.