[OE-core] [PATCH] initscripts: do not save timestamp for readonly system

Richard Purdie richard.purdie at linuxfoundation.org
Sun Nov 22 09:33:13 UTC 2015


On Sat, 2015-11-21 at 22:55 +0100, Ming Liu wrote:
> From: Ming Liu <peter.x.liu at external.atlascopco.com>
> 
> To avoid reporting errors for /etc/timestamp is not writeable in a
> readonly system.
> 
> Signed-off-by: Ming Liu <peter.x.liu at external.atlascopco.com>
> ---
>  meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
> index b038fc5..0f7aa20 100644
> --- a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
> @@ -9,5 +9,7 @@
>  # Description:       
>  ### END INIT INFO
>  
> -# Update the timestamp
> -date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp
> +# Update the timestamp for non-readonly system
> +[ -f /etc/default/rcS ] && . /etc/default/rcS
> +
> +[ "$ROOTFS_READ_ONLY" = "no" ] && date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp

Couldn't we just test if /etc/timestamp is writable first:

[ -w /etc/timestamp ] && date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp

?

Cheers,

Richard






More information about the Openembedded-core mailing list