All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Ming Liu <liu.ming50@gmail.com>
Cc: Ming Liu <peter.x.liu@external.atlascopco.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] initscripts: do not save timestamp for readonly system
Date: Sun, 22 Nov 2015 09:33:13 +0000	[thread overview]
Message-ID: <1448184793.27882.32.camel@linuxfoundation.org> (raw)
In-Reply-To: <1448142950-5321-1-git-send-email-liu.ming50@gmail.com>

On Sat, 2015-11-21 at 22:55 +0100, Ming Liu wrote:
> From: Ming Liu <peter.x.liu@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@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





      reply	other threads:[~2015-11-22  9:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-21 21:55 [PATCH] initscripts: do not save timestamp for readonly system Ming Liu
2015-11-22  9:33 ` Richard Purdie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448184793.27882.32.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=liu.ming50@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=peter.x.liu@external.atlascopco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.