All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/4] Postinst logging reimplementation
@ 2013-05-20  2:50 Qi.Chen
  2013-05-20  2:50 ` [PATCH V2 1/4] image.bbclass: add postinst_enable_logging Qi.Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Qi.Chen @ 2013-05-20  2:50 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

Goal:
1. Enable postinst logging if 'debug-tweaks' is in IMAGE_FEATURES
2. Make rpm, opkg and dpkg not depend on IMAGE_FEATURES and POSTLOG

Implementation:
1. The run-postinst scripts will log outputs by checking the configuration in /etc/default/postinst.
2. The log location is always /var/log/postinstall.log. Do not allow configuration, because this is
   mainly for debugging purpose and /var/log/postinstall.log is a good place. 
   Making it configurable is not necessary.


The following changes since commit a9f5bf0ed398bf9cb861feaa8b6fefd8645b1d09:

  sanity.bbclass: Attach the missing value to a format string. (2013-05-13 21:54:40 +0300)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib ChenQi/postinst-logging-reimplementation
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/postinst-logging-reimplementation

Chen Qi (4):
  image.bbclass: add postinst_enable_logging
  dpkg: modify the run-postinst script to enable postinst logging
  opkg: modify the run-postinst script to enable postinst logging
  rpm-postinsts.bb: enable postinst logging

 meta/classes/image.bbclass                 |    7 +++++++
 meta/recipes-devtools/dpkg/dpkg.inc        |   11 ++++++-----
 meta/recipes-devtools/opkg/opkg.inc        |   11 ++++++-----
 meta/recipes-devtools/rpm/rpm-postinsts.bb |   13 +++++++------
 4 files changed, 26 insertions(+), 16 deletions(-)

-- 
1.7.9.5




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 1/4] image.bbclass: add postinst_enable_logging
  2013-05-20  2:50 [PATCH V2 0/4] Postinst logging reimplementation Qi.Chen
@ 2013-05-20  2:50 ` Qi.Chen
  2013-05-20  2:50 ` [PATCH V2 2/4] dpkg: modify the run-postinst script to enable postinst logging Qi.Chen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Qi.Chen @ 2013-05-20  2:50 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

Add a function postinst_enable_logging, so that when 'debug-tweaks'
is in IMAGE_FEATURES, we create /etc/default/postinst config file,
which is sourced by run-postinst scripts to determine whether to log
or not.

[YOCTO #4262]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/classes/image.bbclass |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 2b42e12..5c02732 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -175,6 +175,8 @@ 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)}'
 
 # some default locales
 IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
@@ -484,6 +486,11 @@ ssh_allow_empty_password () {
 	fi
 }
 
+# Enable postinst logging if debug-tweaks is enabled
+postinst_enable_logging () {
+	echo "POSTINST_LOGGING=ENABLED" >> ${IMAGE_ROOTFS}/etc/default/postinst
+}
+
 # Turn any symbolic /sbin/init link into a file
 remove_init_link () {
 	if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V2 2/4] dpkg: modify the run-postinst script to enable postinst logging
  2013-05-20  2:50 [PATCH V2 0/4] Postinst logging reimplementation Qi.Chen
  2013-05-20  2:50 ` [PATCH V2 1/4] image.bbclass: add postinst_enable_logging Qi.Chen
@ 2013-05-20  2:50 ` Qi.Chen
  2013-05-20 16:09   ` Paul Eggleton
  2013-05-20  2:50 ` [PATCH V2 3/4] opkg: " Qi.Chen
  2013-05-20  2:50 ` [PATCH V2 4/4] rpm-postinsts.bb: " Qi.Chen
  3 siblings, 1 reply; 9+ messages in thread
From: Qi.Chen @ 2013-05-20  2:50 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

Enable postinst logging by checking the configuration in /etc/
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 rebuilt
if IMAGE_FEATURES is changed.

[YOCTO #4262]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-devtools/dpkg/dpkg.inc |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-devtools/dpkg/dpkg.inc b/meta/recipes-devtools/dpkg/dpkg.inc
index d773fbd..c5c8aec 100644
--- a/meta/recipes-devtools/dpkg/dpkg.inc
+++ b/meta/recipes-devtools/dpkg/dpkg.inc
@@ -35,10 +35,6 @@ do_configure () {
     autotools_do_configure
 }
 
-POSTLOG ?= "/var/log/postinstall.log"
-REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} 2>&1', '', d)}"
-REDIRECT_CMD[vardepsexclude] += "IMAGE_FEATURES POSTLOG"
-
 DPKG_INIT_POSITION ?= "98"
 
 do_install_append () {
@@ -67,7 +63,12 @@ if [ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ]; then
 
 	# this happens at S98 where our good 'ole packages script used to run
 	echo "#!/bin/sh
-dpkg --configure -a ${REDIRECT_CMD}
+[ -e /etc/default/postinst ] && . /etc/default/postinst
+if [ \"\$POSTINST_LOGGING\" = \"ENABLED\" ]; then
+    dpkg --configure -a >/var/log/postinstall.log 2>&1
+else
+    dpkg --configure -a
+fi
 rm -f ${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
 " > $D${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
 	chmod 0755 $D${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V2 3/4] opkg: modify the run-postinst script to enable postinst logging
  2013-05-20  2:50 [PATCH V2 0/4] Postinst logging reimplementation Qi.Chen
  2013-05-20  2:50 ` [PATCH V2 1/4] image.bbclass: add postinst_enable_logging Qi.Chen
  2013-05-20  2:50 ` [PATCH V2 2/4] dpkg: modify the run-postinst script to enable postinst logging Qi.Chen
@ 2013-05-20  2:50 ` Qi.Chen
  2013-05-20  2:50 ` [PATCH V2 4/4] rpm-postinsts.bb: " Qi.Chen
  3 siblings, 0 replies; 9+ messages in thread
From: Qi.Chen @ 2013-05-20  2:50 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

Enable postinst logging by checking the configuration in /etc/
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 rebuilt
if IMAGE_FEATURES is changed.

[YOCTO #4262]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-devtools/opkg/opkg.inc |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-devtools/opkg/opkg.inc b/meta/recipes-devtools/opkg/opkg.inc
index c34ac5b..353465b 100644
--- a/meta/recipes-devtools/opkg/opkg.inc
+++ b/meta/recipes-devtools/opkg/opkg.inc
@@ -57,10 +57,6 @@ do_install_append_class-native() {
 	fi
 }
 
-POSTLOG ?= "/var/log/postinstall.log"
-REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} 2>&1', '', d)}"
-REDIRECT_CMD[vardepsexclude] += "IMAGE_FEATURES POSTLOG"
-
 pkg_postinst_${PN} () {
 #!/bin/sh
 if [ "x$D" != "x" ] && [ -f $D${OPKGLIBDIR}/opkg/status ]; then
@@ -68,7 +64,12 @@ if [ "x$D" != "x" ] && [ -f $D${OPKGLIBDIR}/opkg/status ]; then
 
 	# this happens at S98 where our good 'ole packages script used to run
 	echo "#!/bin/sh
-opkg-cl configure ${REDIRECT_CMD}
+[ -e /etc/default/postinst ] && . /etc/default/postinst
+if [ \"\$POSTINST_LOGGING\" = \"ENABLED\" ]; then
+    opkg-cl configure >/var/log/postinstall.log 2>&1
+else
+    opkg-cl configure
+fi
 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
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V2 4/4] rpm-postinsts.bb: enable postinst logging
  2013-05-20  2:50 [PATCH V2 0/4] Postinst logging reimplementation Qi.Chen
                   ` (2 preceding siblings ...)
  2013-05-20  2:50 ` [PATCH V2 3/4] opkg: " Qi.Chen
@ 2013-05-20  2:50 ` Qi.Chen
  2013-05-20 15:38   ` Saul Wold
  3 siblings, 1 reply; 9+ messages in thread
From: Qi.Chen @ 2013-05-20  2:50 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

Enable postinst logging by checking the configuration in /etc/
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]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-devtools/rpm/rpm-postinsts.bb |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb b/meta/recipes-devtools/rpm/rpm-postinsts.bb
index 3d2d05d..01d7450 100644
--- a/meta/recipes-devtools/rpm/rpm-postinsts.bb
+++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb
@@ -11,10 +11,6 @@ inherit allarch
 #
 POSTINSTALL_INITPOSITION ?= "98"
 
-POSTLOG ?= "/var/log/postinstall.log"
-REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>>${POSTLOG} 2>&1', '', d)}"
-REDIRECT_CMD[vardepsexclude] += "IMAGE_FEATURES POSTLOG"
-
 do_fetch() {
 	:
 }
@@ -36,11 +32,16 @@ if [ "x$D" != "x" ] && [ -f $D/var/lib/rpm/Packages ]; then
 	install -d $D/${sysconfdir}/rcS.d
 	cat > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << "EOF"
 #!/bin/sh
-
+[ -e /etc/default/postinst ] && . /etc/default/postinst
 [ -d /etc/rpm-postinsts ] && for i in `ls /etc/rpm-postinsts/`; do
 	i=/etc/rpm-postinsts/$i
 	echo "Running postinst $i..."
-	if [ -f $i ] && $i ${REDIRECT_CMD}; then
+	if [ -x $i ]; then
+		if [ "$POSTINST_LOGGING" = "ENABLED" ]; then
+			$i >/var/log/postinstall.log 2&>1
+		else
+			$i
+		fi
 		rm $i
 	else
 		echo "ERROR: postinst $i failed."
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 4/4] rpm-postinsts.bb: enable postinst logging
  2013-05-20  2:50 ` [PATCH V2 4/4] rpm-postinsts.bb: " Qi.Chen
@ 2013-05-20 15:38   ` Saul Wold
  2013-05-21  2:27     ` ChenQi
  0 siblings, 1 reply; 9+ messages in thread
From: Saul Wold @ 2013-05-20 15:38 UTC (permalink / raw)
  To: Qi.Chen; +Cc: qingtao.cao, openembedded-core

On 05/19/2013 07:50 PM, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> Enable postinst logging by checking the configuration in /etc/
> 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]
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>   meta/recipes-devtools/rpm/rpm-postinsts.bb |   13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb b/meta/recipes-devtools/rpm/rpm-postinsts.bb
> index 3d2d05d..01d7450 100644
> --- a/meta/recipes-devtools/rpm/rpm-postinsts.bb
> +++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb
> @@ -11,10 +11,6 @@ inherit allarch
>   #
>   POSTINSTALL_INITPOSITION ?= "98"
>
> -POSTLOG ?= "/var/log/postinstall.log"
> -REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>>${POSTLOG} 2>&1', '', d)}"
> -REDIRECT_CMD[vardepsexclude] += "IMAGE_FEATURES POSTLOG"
> -
>   do_fetch() {
>   	:
>   }
> @@ -36,11 +32,16 @@ if [ "x$D" != "x" ] && [ -f $D/var/lib/rpm/Packages ]; then
>   	install -d $D/${sysconfdir}/rcS.d
>   	cat > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << "EOF"
>   #!/bin/sh
> -
> +[ -e /etc/default/postinst ] && . /etc/default/postinst
>   [ -d /etc/rpm-postinsts ] && for i in `ls /etc/rpm-postinsts/`; do
>   	i=/etc/rpm-postinsts/$i
>   	echo "Running postinst $i..."
> -	if [ -f $i ] && $i ${REDIRECT_CMD}; then
> +	if [ -x $i ]; then
> +		if [ "$POSTINST_LOGGING" = "ENABLED" ]; then
> +			$i >/var/log/postinstall.log 2&>1

This will over write the results of a previous postinstall because this 
is running in a for look, you should use >> instead of >.

I also suggested that the log file be a variable and you should use the 
${localestatedir} as the base for /var.  So you would add something like 
POSTINST_LOGFILE.

Thanks
	Sau!



> +		else
> +			$i
> +		fi
>   		rm $i
>   	else
>   		echo "ERROR: postinst $i failed."
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 2/4] dpkg: modify the run-postinst script to enable postinst logging
  2013-05-20  2:50 ` [PATCH V2 2/4] dpkg: modify the run-postinst script to enable postinst logging Qi.Chen
@ 2013-05-20 16:09   ` Paul Eggleton
  2013-05-21  2:25     ` ChenQi
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Eggleton @ 2013-05-20 16:09 UTC (permalink / raw)
  To: Qi.Chen; +Cc: qingtao.cao, openembedded-core

On Monday 20 May 2013 10:50:29 Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
> 
> Enable postinst logging by checking the configuration in /etc/
> 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 rebuilt
> if IMAGE_FEATURES is changed.
> 
> [YOCTO #4262]
> 
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/recipes-devtools/dpkg/dpkg.inc |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/recipes-devtools/dpkg/dpkg.inc
> b/meta/recipes-devtools/dpkg/dpkg.inc index d773fbd..c5c8aec 100644
> --- a/meta/recipes-devtools/dpkg/dpkg.inc
> +++ b/meta/recipes-devtools/dpkg/dpkg.inc
> @@ -35,10 +35,6 @@ do_configure () {
>      autotools_do_configure
>  }
> 
> -POSTLOG ?= "/var/log/postinstall.log"
> -REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks',
> '>${POSTLOG} 2>&1', '', d)}" -REDIRECT_CMD[vardepsexclude] +=
> "IMAGE_FEATURES POSTLOG"
> -
>  DPKG_INIT_POSITION ?= "98"
> 
>  do_install_append () {
> @@ -67,7 +63,12 @@ if [ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ];
> then
> 
>  	# this happens at S98 where our good 'ole packages script used to run
>  	echo "#!/bin/sh
> -dpkg --configure -a ${REDIRECT_CMD}
> +[ -e /etc/default/postinst ] && . /etc/default/postinst
> +if [ \"\$POSTINST_LOGGING\" = \"ENABLED\" ]; then

Can we use 1 for this instead of ENABLED? This would be more consistent with 
how variables such as this are generally used.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 2/4] dpkg: modify the run-postinst script to enable postinst logging
  2013-05-20 16:09   ` Paul Eggleton
@ 2013-05-21  2:25     ` ChenQi
  0 siblings, 0 replies; 9+ messages in thread
From: ChenQi @ 2013-05-21  2:25 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: qingtao.cao, openembedded-core

On 05/21/2013 12:09 AM, Paul Eggleton wrote:
> On Monday 20 May 2013 10:50:29 Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> Enable postinst logging by checking the configuration in /etc/
>> 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 rebuilt
>> if IMAGE_FEATURES is changed.
>>
>> [YOCTO #4262]
>>
>> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>> ---
>>   meta/recipes-devtools/dpkg/dpkg.inc |   11 ++++++-----
>>   1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/meta/recipes-devtools/dpkg/dpkg.inc
>> b/meta/recipes-devtools/dpkg/dpkg.inc index d773fbd..c5c8aec 100644
>> --- a/meta/recipes-devtools/dpkg/dpkg.inc
>> +++ b/meta/recipes-devtools/dpkg/dpkg.inc
>> @@ -35,10 +35,6 @@ do_configure () {
>>       autotools_do_configure
>>   }
>>
>> -POSTLOG ?= "/var/log/postinstall.log"
>> -REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks',
>> '>${POSTLOG} 2>&1', '', d)}" -REDIRECT_CMD[vardepsexclude] +=
>> "IMAGE_FEATURES POSTLOG"
>> -
>>   DPKG_INIT_POSITION ?= "98"
>>
>>   do_install_append () {
>> @@ -67,7 +63,12 @@ if [ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ];
>> then
>>
>>   	# this happens at S98 where our good 'ole packages script used to run
>>   	echo "#!/bin/sh
>> -dpkg --configure -a ${REDIRECT_CMD}
>> +[ -e /etc/default/postinst ] && . /etc/default/postinst
>> +if [ \"\$POSTINST_LOGGING\" = \"ENABLED\" ]; then
> Can we use 1 for this instead of ENABLED? This would be more consistent with
> how variables such as this are generally used.
>
> Cheers,
> Paul
>
Thanks, I'll do that and send out a v3 soon.

Best Regards,
Chen Qi


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 4/4] rpm-postinsts.bb: enable postinst logging
  2013-05-20 15:38   ` Saul Wold
@ 2013-05-21  2:27     ` ChenQi
  0 siblings, 0 replies; 9+ messages in thread
From: ChenQi @ 2013-05-21  2:27 UTC (permalink / raw)
  To: Saul Wold; +Cc: qingtao.cao, openembedded-core

On 05/20/2013 11:38 PM, Saul Wold wrote:
> On 05/19/2013 07:50 PM, Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> Enable postinst logging by checking the configuration in /etc/
>> 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]
>>
>> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>> ---
>>   meta/recipes-devtools/rpm/rpm-postinsts.bb |   13 +++++++------
>>   1 file changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb 
>> b/meta/recipes-devtools/rpm/rpm-postinsts.bb
>> index 3d2d05d..01d7450 100644
>> --- a/meta/recipes-devtools/rpm/rpm-postinsts.bb
>> +++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb
>> @@ -11,10 +11,6 @@ inherit allarch
>>   #
>>   POSTINSTALL_INITPOSITION ?= "98"
>>
>> -POSTLOG ?= "/var/log/postinstall.log"
>> -REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', 
>> '>>${POSTLOG} 2>&1', '', d)}"
>> -REDIRECT_CMD[vardepsexclude] += "IMAGE_FEATURES POSTLOG"
>> -
>>   do_fetch() {
>>       :
>>   }
>> @@ -36,11 +32,16 @@ if [ "x$D" != "x" ] && [ -f 
>> $D/var/lib/rpm/Packages ]; then
>>       install -d $D/${sysconfdir}/rcS.d
>>       cat > 
>> $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << "EOF"
>>   #!/bin/sh
>> -
>> +[ -e /etc/default/postinst ] && . /etc/default/postinst
>>   [ -d /etc/rpm-postinsts ] && for i in `ls /etc/rpm-postinsts/`; do
>>       i=/etc/rpm-postinsts/$i
>>       echo "Running postinst $i..."
>> -    if [ -f $i ] && $i ${REDIRECT_CMD}; then
>> +    if [ -x $i ]; then
>> +        if [ "$POSTINST_LOGGING" = "ENABLED" ]; then
>> +            $i >/var/log/postinstall.log 2&>1
>
> This will over write the results of a previous postinstall because 
> this is running in a for look, you should use >> instead of >.
>
> I also suggested that the log file be a variable and you should use 
> the ${localestatedir} as the base for /var.  So you would add 
> something like POSTINST_LOGFILE.
>
> Thanks
>     Sau!
>
>
Thanks for pointing the error out.

I'll fix it and send out a V3 soon.

Best Regards,
Chen Qi
>
>> +        else
>> +            $i
>> +        fi
>>           rm $i
>>       else
>>           echo "ERROR: postinst $i failed."
>>
>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-05-21  2:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-20  2:50 [PATCH V2 0/4] Postinst logging reimplementation Qi.Chen
2013-05-20  2:50 ` [PATCH V2 1/4] image.bbclass: add postinst_enable_logging Qi.Chen
2013-05-20  2:50 ` [PATCH V2 2/4] dpkg: modify the run-postinst script to enable postinst logging Qi.Chen
2013-05-20 16:09   ` Paul Eggleton
2013-05-21  2:25     ` ChenQi
2013-05-20  2:50 ` [PATCH V2 3/4] opkg: " Qi.Chen
2013-05-20  2:50 ` [PATCH V2 4/4] rpm-postinsts.bb: " Qi.Chen
2013-05-20 15:38   ` Saul Wold
2013-05-21  2:27     ` ChenQi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.