]> code.ossystems Code Review - openembedded-core.git/commitdiff
image.bbclass: add postinst_enable_logging
authorChen Qi <Qi.Chen@windriver.com>
Thu, 23 May 2013 04:43:33 +0000 (12:43 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 23 May 2013 09:27:39 +0000 (10:27 +0100)
Add a function postinst_enable_logging, so that when 'debug-tweaks'
is in IMAGE_FEATURES, we create ${sysconfdir}/default/postinst config
file, which is sourced by run-postinst scripts to determine whether
to log or not, and where to log.

[YOCTO #4262]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/image.bbclass

index 4f077082da8d4312a63ab2af9391f5e8bfc5f5be..04db53312894a0be4b4b7ab3a9aa83e986f0fcc8 100644 (file)
@@ -175,6 +175,10 @@ MACHINE_POSTPROCESS_COMMAND ?= ""
 ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; "
 # Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks is enabled
 ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "ssh_allow_empty_password; ", "",d)}'
+# Enable postinst logging if debug-tweaks is enabled
+ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "postinst_enable_logging; ", "",d)}'
+# Set default postinst log file
+POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
 
 # some default locales
 IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
@@ -484,6 +488,13 @@ ssh_allow_empty_password () {
        fi
 }
 
+# Enable postinst logging if debug-tweaks is enabled
+postinst_enable_logging () {
+       mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/default
+       echo "POSTINST_LOGGING=1" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst
+       echo "LOGFILE=${POSTINST_LOGFILE}" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst
+}
+
 # Turn any symbolic /sbin/init link into a file
 remove_init_link () {
        if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then