Patchwork [1/5] opkg: save output of postinst scripts when image first boot

login
register
mail settings
Submitter Kang Kai
Date Feb. 26, 2013, 8:14 a.m.
Message ID <34981f55190c54c7fbccbb00f61bf4f6821fb0b7.1361866256.git.kai.kang@windriver.com>
Download mbox | patch
Permalink /patch/45089/
State Accepted
Commit 0276db5e64e2a233c673e55c3ac1fdefe3030f39
Headers show

Comments

Kang Kai - Feb. 26, 2013, 8:14 a.m.
When image feature "debug-tweaks" enabled, save output of postinstall
scripts to log file /var/log/postinstall.log when image first boot. And the
log file can be configured.

It also needs image feature "package-management" enabled. If not,
package run-postinsts will be installed and then all packages will be
configured by it. Command 'opkg configure' outputs nothing.

[YOCTO #3223]

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 meta/recipes-devtools/opkg/opkg.inc |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Patch

diff --git a/meta/recipes-devtools/opkg/opkg.inc b/meta/recipes-devtools/opkg/opkg.inc
index 8d48006..f9c1202 100644
--- a/meta/recipes-devtools/opkg/opkg.inc
+++ b/meta/recipes-devtools/opkg/opkg.inc
@@ -57,13 +57,16 @@  do_install_append_class-native() {
 	fi
 }
 
+POSTLOG ?= "/var/log/postinstall.log"
+REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} 2>&1', '', d)}"
+
 pkg_postinst_${PN} () {
 #!/bin/sh
 if [ "x$D" != "x" ]; then
 	install -d $D${sysconfdir}/rcS.d
 	# this happens at S98 where our good 'ole packages script used to run
 	echo "#!/bin/sh
-opkg-cl configure
+opkg-cl configure ${REDIRECT_CMD}
 rm -f /${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
 " > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
 	chmod 0755 $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts