* [PATCH] initscripts: do not save timestamp for readonly system
@ 2015-11-21 21:55 Ming Liu
2015-11-22 9:33 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Ming Liu @ 2015-11-21 21:55 UTC (permalink / raw)
To: openembedded-core; +Cc: Ming Liu
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
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] initscripts: do not save timestamp for readonly system
2015-11-21 21:55 [PATCH] initscripts: do not save timestamp for readonly system Ming Liu
@ 2015-11-22 9:33 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2015-11-22 9:33 UTC (permalink / raw)
To: Ming Liu; +Cc: Ming Liu, openembedded-core
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-22 9:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-21 21:55 [PATCH] initscripts: do not save timestamp for readonly system Ming Liu
2015-11-22 9:33 ` Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox