From patchwork Tue Feb 26 08:14:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5/5] rpm: save output of postinstall scripts when image first boot Date: Tue, 26 Feb 2013 08:14:29 -0000 From: Kang Kai X-Patchwork-Id: 45093 Message-Id: <0e45eb2f773f3985d6cc47e78775a26271806b30.1361866257.git.kai.kang@windriver.com> To: Cc: Zhenfeng.Zhao@windriver.com When image feature "debug-tweaks" is enabled, save output of post install script to log file which can be configured when image first boot. [YOCTO #3223] Signed-off-by: Kang Kai --- meta/recipes-devtools/rpm/rpm_5.4.9.bb | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/meta/recipes-devtools/rpm/rpm_5.4.9.bb b/meta/recipes-devtools/rpm/rpm_5.4.9.bb index 0b014b6..cdfb5ff 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.9.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.9.bb @@ -223,6 +223,7 @@ FILES_${PN} = "${bindir}/rpm \ ${libdir}/rpm/bin/wget \ /var/lib/rpm \ /var/cache/rpm \ + ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts \ " FILES_${PN}-dbg += "${libdir}/rpm/.debug \ @@ -374,6 +375,9 @@ do_configure() { # POSTINSTALL_INITPOSITION ?= "98" +POSTLOG ?= "/var/log/postinstall.log" +REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>>${POSTLOG} 2>&1', '', d)}" + do_install_append() { sed -i -e 's,%__check_files,#%%__check_files,' ${D}/${libdir}/rpm/macros sed -i -e 's,%__scriptlet_requires,#%%__scriptlet_requires,' ${D}/${libdir}/rpm/macros @@ -459,7 +463,7 @@ do_install_append() { for i in \`ls /etc/rpm-postinsts/\`; do i=/etc/rpm-postinsts/$i echo "Running postinst $i..." - if [ -f $i ] && $i; then + if [ -f $i ] && $i ${REDIRECT_CMD}; then rm $i else echo "ERROR: postinst $i failed."