summaryrefslogtreecommitdiff
path: root/packages/initscripts/initscripts-1.0/bootmisc.sh
diff options
context:
space:
mode:
authorOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2007-10-07 00:34:07 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2007-10-07 00:34:07 +0000
commit2f8521c6d1173dd650d9ae2bba8c18e690fa3b1f (patch)
tree06bc2b997b60797bc42f696f3427f92890089d2b /packages/initscripts/initscripts-1.0/bootmisc.sh
parent0d0bf315513039bd8560ac91865c7174e789d675 (diff)
parent6e90aae26efa66553063b74b9afa9563b70fb982 (diff)
merge of '603b2d0c7e4ad80e5779bd3bbdb822331cc0ea2b'
and '6ab53da82d157971966f5a17d0c29d54df22cac9'
Diffstat (limited to 'packages/initscripts/initscripts-1.0/bootmisc.sh')
-rwxr-xr-xpackages/initscripts/initscripts-1.0/bootmisc.sh20
1 files changed, 11 insertions, 9 deletions
diff --git a/packages/initscripts/initscripts-1.0/bootmisc.sh b/packages/initscripts/initscripts-1.0/bootmisc.sh
index 799cdca12b..2a40e0c410 100755
--- a/packages/initscripts/initscripts-1.0/bootmisc.sh
+++ b/packages/initscripts/initscripts-1.0/bootmisc.sh
@@ -61,16 +61,18 @@ fi
#
/sbin/ldconfig
-#
-# Recover the time, if there is a time file (first boot only)
-# If not, set system clock from hardware clock
-#
+# Set the system clock from hardware clock
+# If the timestamp is 1 day or more recent than the current time,
+# use the timestamp instead.
+/etc/init.d/hwclock.sh start
if test -e /etc/timestamp
then
- date -s `cat /etc/timestamp`
- mv -f /etc/timestamp /etc/timestamp.done
- /etc/init.d/hwclock.sh stop
-else
- /etc/init.d/hwclock.sh start
+ 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
: exit 0