Skip to contentSkip to conversation

initscripts: do not save timestamp for readonly system

PATCH In review Ming Liu 2 participants 2 messages Nov 21, 2015 – Nov 22, 2015

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh +4 -2
index b038fc5..0f7aa20 100644
@@ -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
#1 lore raw
Quoted 15 lines · Ming Liu

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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh +0 -0
index b038fc5..0f7aa20 100644

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