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.
Signed-off-by Ming Liu <[email protected]>
--- meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh +4 -2
@@ -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
Signature · 1 line
1.9.1
Quoted 15 lines · Ming Liu
From: Ming Liu <[email protected]>
To avoid reporting errors for
/etc/timestampis not writeable in a readonly system.Signed-off-by Ming Liu <[email protected]>--- meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh +0
-0
meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh line 15
Quoted 9 lines
meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh +4
-2@@ -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