[oe] [PATCH] init-scripts: introduce DONTUSETIMESTAMP variable in bootmisc.sh

Petr Štetiar ynezz at true.cz
Wed Oct 6 18:14:58 UTC 2010


This variable is useful on systems with battery backed RTC. Imagine, that the
board is shut down and then switched on after, for example three days.
Althought the value in RTC is correct, this scripts sets system time with the
wrong values.

Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 recipes/initscripts/initscripts-1.0/bootmisc.sh |   15 +++++++++------
 recipes/initscripts/initscripts_1.0.bb          |    2 +-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/recipes/initscripts/initscripts-1.0/bootmisc.sh b/recipes/initscripts/initscripts-1.0/bootmisc.sh
index d19477b..6abefcd 100755
--- a/recipes/initscripts/initscripts-1.0/bootmisc.sh
+++ b/recipes/initscripts/initscripts-1.0/bootmisc.sh
@@ -69,12 +69,15 @@ fi
 test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
 if test -e /etc/timestamp
 then
-	SYSTEMDATE=`date "+%Y%m%d"`
-	TIMESTAMP=`cat /etc/timestamp | awk '{ print substr($0,9,4) substr($0,1,4);}'`
-        NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE \)`                                                 
-        if [ $NEEDUPDATE -eq 1 ]; then 
-		date `cat /etc/timestamp`
-		/etc/init.d/hwclock.sh stop
+	if test "$DONTUSETIMESTAMP" != no
+	then
+		SYSTEMDATE=`date "+%Y%m%d"`
+		TIMESTAMP=`cat /etc/timestamp | awk '{ print substr($0,9,4) substr($0,1,4);}'`
+	        NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE \)`                                                 
+        	if [ $NEEDUPDATE -eq 1 ]; then 
+			date `cat /etc/timestamp`
+			/etc/init.d/hwclock.sh stop
+		fi
 	fi
 fi
 : exit 0
diff --git a/recipes/initscripts/initscripts_1.0.bb b/recipes/initscripts/initscripts_1.0.bb
index cc60624..3987c60 100644
--- a/recipes/initscripts/initscripts_1.0.bb
+++ b/recipes/initscripts/initscripts_1.0.bb
@@ -4,7 +4,7 @@ PRIORITY = "required"
 DEPENDS = "makedevs"
 RDEPENDS_${PN} = "makedevs"
 LICENSE = "GPL"
-PR = "r124"
+PR = "r125"
 
 SRC_URI = "file://functions \
            file://halt \
-- 
1.7.0.4





More information about the Openembedded-devel mailing list