initscripts: do not save timestamp for readonly system
PATCH 1/1 initscripts: do not save timestamp for readonly system
From: Ming Liu <[email protected]>
To avoid reporting errors for /etc/timestamp is not writeable in a readonly system.
--- meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh +2 -2
@@ -9,5 +9,5 @@ # Description: ### END INIT INFO -# Update the timestamp -date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp +# Update the timestamp for writeable system +[ -w /etc/timestamp ] && date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp
Signature · 1 line
1.9.1
Quoted 2 lines · Ming Liu
+[ -w
/etc/timestamp] && date -u +%4Y%2m%2d%2H%2M%2S >/etc/timestamp
This would fail if /etc/timestamp doesn't already exist. I'm tempted to say you should just 2>/dev/null so it tries and the error is hidden in case /etc/timestamp is deleted on a writable file system.
Ross
Quoted 7 lines · Ross
On 23 November 2015 at 09:42, Ming Liu <[email protected] <mailto:[email protected]>> wrote:
+[ -w /etc/timestamp ] && date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestampThis would fail if
/etc/timestampdoesn't already exist. I'm tempted to say you should just 2>/dev/null so it tries and the error is hidden in case/etc/timestampis deleted on a writable file system.
Yes, that is true! I did not consider that case, then I will send a V2 soon.
//Ming Liu
Quoted 2 lines
Ross