rpm: save output of postinstall scripts when image first boot

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]

(From OE-Core rev: 94a58c153958002b117fcb5eeaef3d22be71a0f6)

Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Kang Kai 2013-02-25 11:06:51 +08:00 committed by Richard Purdie
parent f9cfc9f37a
commit 9ed59a5d18
1 changed files with 5 additions and 1 deletions

View File

@ -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."