diff options
author | Scott Rifenbark <srifenbark@gmail.com> | 2018-11-13 10:29:59 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-22 12:20:52 +0000 |
commit | e33920f4c94312efdb09ce6305aa353f323a6c38 (patch) | |
tree | 5c97d10d36395fec207487b603bce179c286e237 /documentation | |
parent | 69f269e09087ec18fb0dd29ff3c6555e91a422c2 (diff) | |
download | poky-e33920f4c94312efdb09ce6305aa353f323a6c38.tar.gz |
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 <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 38 |
1 files changed, 15 insertions, 23 deletions
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 @@ | |||
3237 | post-installation script to be delayed until the first boot. | 3237 | post-installation script to be delayed until the first boot. |
3238 | For example, the script might need to be executed on the | 3238 | For example, the script might need to be executed on the |
3239 | device itself. | 3239 | device itself. |
3240 | To delay script execution until boot time, use the following | 3240 | To delay script execution until boot time, you must explicitly |
3241 | structure in the post-installation script: | 3241 | mark post installs to defer to the target. |
3242 | <literallayout class='monospaced'> | 3242 | You can use <filename>pkg_postinst_ontarget()</filename> or |
3243 | pkg_postinst_<replaceable>PACKAGENAME</replaceable>() { | 3243 | call |
3244 | if [ x"$D" = "x" ]; then | 3244 | <filename>postinst-intercepts defer_to_first_boot</filename> |
3245 | # Actions to carry out on the device go here | 3245 | from <filename>pkg_postinst()</filename>. |
3246 | else | 3246 | Any failure of a <filename>pkg_postinst()</filename> script |
3247 | exit 1 | 3247 | (including exit 1) triggers an error during the |
3248 | fi | 3248 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-rootfs'><filename>do_rootfs</filename></ulink> |
3249 | } | 3249 | task. |
3250 | </literallayout> | ||
3251 | </para> | ||
3252 | |||
3253 | <para> | ||
3254 | The previous example delays execution until the image boots | ||
3255 | again because the environment variable <filename>D</filename> | ||
3256 | points to the directory containing the image when | ||
3257 | the root filesystem is created at build time but is unset | ||
3258 | when executed on the first boot. | ||
3259 | </para> | 3250 | </para> |
3260 | 3251 | ||
3261 | <para> | 3252 | <para> |
3262 | If you have recipes that use <filename>pkg_postinst</filename> | 3253 | If you have recipes that use |
3263 | scripts and they require the use of non-standard native | 3254 | <filename>pkg_postinst</filename> function |
3255 | and they require the use of non-standard native | ||
3264 | tools that have dependencies during rootfs construction, you | 3256 | tools that have dependencies during rootfs construction, you |
3265 | need to use the | 3257 | need to use the |
3266 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGE_WRITE_DEPS'><filename>PACKAGE_WRITE_DEPS</filename></ulink> | 3258 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGE_WRITE_DEPS'><filename>PACKAGE_WRITE_DEPS</filename></ulink> |
@@ -3279,8 +3271,8 @@ | |||
3279 | <filename>pkg_prerm</filename>, and | 3271 | <filename>pkg_prerm</filename>, and |
3280 | <filename>pkg_postrm</filename>, respectively. | 3272 | <filename>pkg_postrm</filename>, respectively. |
3281 | These scrips work in exactly the same way as does | 3273 | These scrips work in exactly the same way as does |
3282 | <filename>pkg_postinst</filename> with the exception that they | 3274 | <filename>pkg_postinst</filename> with the exception |
3283 | run at different times. | 3275 | that they run at different times. |
3284 | Also, because of when they run, they are not applicable to | 3276 | Also, because of when they run, they are not applicable to |
3285 | being run at image creation time like | 3277 | being run at image creation time like |
3286 | <filename>pkg_postinst</filename>. | 3278 | <filename>pkg_postinst</filename>. |