diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index bdf9cfc241..f9b2910578 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml @@ -3207,21 +3207,21 @@ a package on the target or during image creation when a package is included in an image. To add a post-installation script to a package, add a - pkg_postinst_PACKAGENAME() function to + pkg_postinst_PACKAGENAME() function to the recipe file (.bb) and replace - PACKAGENAME with the name of the package + PACKAGENAME with the name of the package you want to attach to the postinst script. To apply the post-installation script to the main package for the recipe, which is usually what is required, specify ${PN} - in place of PACKAGENAME. + in place of PACKAGENAME. A post-installation function has the following structure: - pkg_postinst_PACKAGENAME() { + pkg_postinst_PACKAGENAME() { # Commands to carry out } @@ -3250,7 +3250,7 @@ To delay script execution until boot time, use the following structure in the post-installation script: - pkg_postinst_PACKAGENAME() { + pkg_postinst_PACKAGENAME() { if [ x"$D" = "x" ]; then # Actions to carry out on the device go here else @@ -3268,6 +3268,20 @@ when executed on the first boot. + + If you have recipes that use pkg_postinst + scripts and they require the use of non-standard native + tools that have dependencies during rootfs construction, you + need to use the + PACKAGE_WRITE_DEPS + variable in your recipe to list these tools. + If you do not use this variable, the tools might be missing and + execution of the post-installation script is deferred until + first boot. + Deferring the script to first boot is undesirable and for + read-only rootfs impossible. + + Equivalent support for pre-install, pre-uninstall, and post-uninstall scripts exist by way of diff --git a/documentation/ref-manual/ref-variables.xml b/documentation/ref-manual/ref-variables.xml index 758de36e70..ae2abdeddc 100644 --- a/documentation/ref-manual/ref-variables.xml +++ b/documentation/ref-manual/ref-variables.xml @@ -9318,6 +9318,31 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" + PACKAGE_WRITE_DEPS + + PACKAGE_WRITE_DEPS[doc] = "Specifies post-installation and pre-installation script dependencies on native/cross tools." + + + + + Specifies a list of dependencies for post-installation and + pre-installation scripts on native/cross tools. + If your post-installation or pre-installation script can + execute at rootfs creation time rather than on the + target but depends on a native tool in order to execute, + you need to list the tools in + PACKAGE_WRITE_DEPENDS. + + + + For information on running post-installation scripts, see + the + "Post-Installation Scripts" + section in the Yocto Project Development Manual. + + + + PACKAGECONFIG PACKAGECONFIG[doc] = "This variable provides a means of enabling or disabling features of a recipe on a per-recipe basis."