From e33920f4c94312efdb09ce6305aa353f323a6c38 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Tue, 13 Nov 2018 10:29:59 -0800 Subject: 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: 1bcec14eed720fd05e81fbe7ecaa2f95174c0fbf) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- .../dev-manual/dev-manual-common-tasks.xml | 38 +++++++++------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'documentation') diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index eb7ca69730..c75e718d67 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml @@ -3237,30 +3237,22 @@ post-installation script to be delayed until the first boot. For example, the script might need to be executed on the device itself. - To delay script execution until boot time, use the following - structure in the post-installation script: - - pkg_postinst_PACKAGENAME() { - if [ x"$D" = "x" ]; then - # Actions to carry out on the device go here - else - exit 1 - fi - } - - - - - The previous example delays execution until the image boots - again because the environment variable D - points to the directory containing the image when - the root filesystem is created at build time but is unset - when executed on the first boot. + To delay script execution until boot time, you must explicitly + mark post installs to defer to the target. + You can use pkg_postinst_ontarget() or + call + postinst-intercepts defer_to_first_boot + from pkg_postinst(). + Any failure of a pkg_postinst() script + (including exit 1) triggers an error during the + do_rootfs + task. - If you have recipes that use pkg_postinst - scripts and they require the use of non-standard native + If you have recipes that use + pkg_postinst function + and they require the use of non-standard native tools that have dependencies during rootfs construction, you need to use the PACKAGE_WRITE_DEPS @@ -3279,8 +3271,8 @@ pkg_prerm, and pkg_postrm, respectively. These scrips work in exactly the same way as does - pkg_postinst with the exception that they - run at different times. + pkg_postinst with the exception + that they run at different times. Also, because of when they run, they are not applicable to being run at image creation time like pkg_postinst. -- cgit v1.2.3-54-g00ecf