Patchwork [1/4] image.bbclass: add postinst_enable_logging

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date May 16, 2013, 7:56 a.m.
Message ID <d978543b3558dc8cc14379cd10506c3f0c6f2953.1368690819.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/49987/
State New
Headers show

Comments

Qi.Chen@windriver.com - May 16, 2013, 7:56 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

Add a function postinst_enable_logging, so that when 'debug-tweaks'
is in IMAGE_FEATURES, we create .enable_postinst_logging under /etc,
which is used 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(+)
Martin Jansa - May 16, 2013, 9:03 a.m.
On Thu, May 16, 2013 at 03:56:14PM +0800, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
> 
> Add a function postinst_enable_logging, so that when 'debug-tweaks'
> is in IMAGE_FEATURES, we create .enable_postinst_logging under /etc,
> which is used 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..fc5e23c 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 () {

cannot we use better file for this? it will be first hidden file in /etc

> +	touch ${IMAGE_ROOTFS}/etc/.enable_postinst_logging
> +}
> +
>  # Turn any symbolic /sbin/init link into a file
>  remove_init_link () {
>  	if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
> -- 
> 1.7.9.5
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Saul Wold - May 16, 2013, 6:32 p.m.
On 05/16/2013 10:56 AM, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> Add a function postinst_enable_logging, so that when 'debug-tweaks'
> is in IMAGE_FEATURES, we create .enable_postinst_logging under /etc,
> which is used 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..fc5e23c 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 () {
> +	touch ${IMAGE_ROOTFS}/etc/.enable_postinst_logging

I do not think this should go here, maybe better to have it in the 
/etc/default dir and named postinst, since that matches what other init
related scripts do and source the file in each postinst script, it 
should also have a standard guard to check existance of the file and 
checks something like a "ENABLED" variable instead?  This could also be 
extended for getting the log file location also.

Sau!


> +}
> +
>   # Turn any symbolic /sbin/init link into a file
>   remove_init_link () {
>   	if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
>
Qi.Chen@windriver.com - May 17, 2013, 2:46 a.m.
On 05/17/2013 02:32 AM, Saul Wold wrote:
> On 05/16/2013 10:56 AM, Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> Add a function postinst_enable_logging, so that when 'debug-tweaks'
>> is in IMAGE_FEATURES, we create .enable_postinst_logging under /etc,
>> which is used 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..fc5e23c 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 () {
>> +    touch ${IMAGE_ROOTFS}/etc/.enable_postinst_logging
>
> I do not think this should go here, maybe better to have it in the 
> /etc/default dir and named postinst, since that matches what other init
> related scripts do and source the file in each postinst script, it 
> should also have a standard guard to check existance of the file and 
> checks something like a "ENABLED" variable instead?  This could also 
> be extended for getting the log file location also.
>
> Sau!
>

Thanks a lot.
I'll follow your advices and send out a v2.

Best Regards,
Chen Qi

>
>> +}
>> +
>>   # Turn any symbolic /sbin/init link into a file
>>   remove_init_link () {
>>       if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
>>
>
>

Patch

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 2b42e12..fc5e23c 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 () {
+	touch ${IMAGE_ROOTFS}/etc/.enable_postinst_logging
+}
+
 # Turn any symbolic /sbin/init link into a file
 remove_init_link () {
 	if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then