summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2013-05-23 12:43:36 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-23 10:28:05 +0100
commitf7b639e527a65f9ce77aef07651ac5ec1e094e52 (patch)
treec5d95cf026102f667018f9db14a5e531f3492133
parent0bf2c0af71dd506e8019bdd5b2b3b826062185a3 (diff)
downloadpoky-f7b639e527a65f9ce77aef07651ac5ec1e094e52.tar.gz
rpm-postinsts.bb: enable postinst logging
Enable postinst logging by checking the configuration in ${sysconfdir} /default/postinst. In this way, the postinst logging is enabled if 'debug-tweaks' is in IMAGE_FEATURES, and at the same time, we avoid unnecessary rebuild if IMAGE_FEATURES is changed. [YOCTO #4262] (From OE-Core rev: 6f2aa32f10c24c84e581128bb3a976ef071197ac) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/rpm/rpm-postinsts.bb17
1 files changed, 9 insertions, 8 deletions
diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb b/meta/recipes-devtools/rpm/rpm-postinsts.bb
index 3c0f520d28..c8fc1c33f4 100644
--- a/meta/recipes-devtools/rpm/rpm-postinsts.bb
+++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb
@@ -9,10 +9,6 @@ inherit allarch
9# 9#
10POSTINSTALL_INITPOSITION ?= "98" 10POSTINSTALL_INITPOSITION ?= "98"
11 11
12POSTLOG ?= "/var/log/postinstall.log"
13REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>>${POSTLOG} 2>&1', '', d)}"
14REDIRECT_CMD[vardepsexclude] += "IMAGE_FEATURES POSTLOG"
15
16do_fetch() { 12do_fetch() {
17 : 13 :
18} 14}
@@ -34,11 +30,16 @@ if [ "x$D" != "x" ] && [ -f $D/var/lib/rpm/Packages ]; then
34 install -d $D/${sysconfdir}/rcS.d 30 install -d $D/${sysconfdir}/rcS.d
35 cat > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << "EOF" 31 cat > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << "EOF"
36#!/bin/sh 32#!/bin/sh
37 33[ -e ${sysconfdir}/default/postinst ] && . ${sysconfdir}/default/postinst
38[ -d /etc/rpm-postinsts ] && for i in `ls /etc/rpm-postinsts/`; do 34[ -d ${sysconfdir}/rpm-postinsts ] && for i in `ls ${sysconfdir}/rpm-postinsts/`; do
39 i=/etc/rpm-postinsts/$i 35 i=${sysconfdir}/rpm-postinsts/$i
40 echo "Running postinst $i..." 36 echo "Running postinst $i..."
41 if [ -f $i ] && $i ${REDIRECT_CMD}; then 37 if [ -x $i ]; then
38 if [ "$POSTINST_LOGGING" = "1" ]; then
39 $i >>$LOGFILE 2&>1
40 else
41 $i
42 fi
42 rm $i 43 rm $i
43 else 44 else
44 echo "ERROR: postinst $i failed." 45 echo "ERROR: postinst $i failed."