[oe-commits] org.oe.dev initscipts: Improve RTC handling so /etc/timestamp is used if its timestamp is 1 day or more greater than the existing time. Also set the timestamp on halt/reboot so devices without a hardware RTC (or with a broken RTC like the PXA) can benefit.
rpurdie commit
openembedded-commits at lists.openembedded.org
Sun Sep 2 19:45:14 UTC 2007
initscipts: Improve RTC handling so /etc/timestamp is used if its timestamp is 1 day or more greater than the existing time. Also set the timestamp on halt/reboot so devices without a hardware RTC (or with a broken RTC like the PXA) can benefit.
Author: rpurdie at openembedded.org
Branch: org.openembedded.dev
Revision: 266638ec26255a3fb58a5a6998a8549713b2147c
ViewMTN: http://monotone.openembedded.org/revision.psp?id=266638ec26255a3fb58a5a6998a8549713b2147c
Files:
1
packages/initscripts/initscripts-1.0/bootmisc.sh
packages/initscripts/initscripts-1.0/save-rtc.sh
packages/initscripts/initscripts_1.0.bb
Diffs:
#
# mt diff -rd73aff45b807540bc5ac94ff53514d20fd7e9536 -r266638ec26255a3fb58a5a6998a8549713b2147c
#
#
#
# patch "packages/initscripts/initscripts-1.0/bootmisc.sh"
# from [43ecc46db9908042b08383318d0d5821022e2b74]
# to [da594a80080c827698fc1ffc6c9c1422c589ef9a]
#
# patch "packages/initscripts/initscripts-1.0/save-rtc.sh"
# from [6af9ccb6d852efaecd4b9d74c447997b112f416b]
# to [61b6aa1f48030ec0eef2dae4acd1ffc9d7f0e2a9]
#
# patch "packages/initscripts/initscripts_1.0.bb"
# from [6f8d1e9840c32de6d309e80f06dad7662fc4f1a8]
# to [727244fc404dd16e47c6165fbf3dbb7a55139338]
#
============================================================
--- packages/initscripts/initscripts-1.0/bootmisc.sh 43ecc46db9908042b08383318d0d5821022e2b74
+++ packages/initscripts/initscripts-1.0/bootmisc.sh da594a80080c827698fc1ffc6c9c1422c589ef9a
@@ -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
============================================================
--- packages/initscripts/initscripts-1.0/save-rtc.sh 6af9ccb6d852efaecd4b9d74c447997b112f416b
+++ packages/initscripts/initscripts-1.0/save-rtc.sh 61b6aa1f48030ec0eef2dae4acd1ffc9d7f0e2a9
@@ -1,3 +1,5 @@
#! /bin/sh
-#FIXME read timestamp handling for systems where RTC doesn't survive a reboot
/etc/init.d/hwclock.sh stop
+
+# Update the timestamp
+date +%2m%2d%2H%2M%Y > /etc/timestamp
============================================================
--- packages/initscripts/initscripts_1.0.bb 6f8d1e9840c32de6d309e80f06dad7662fc4f1a8
+++ packages/initscripts/initscripts_1.0.bb 727244fc404dd16e47c6165fbf3dbb7a55139338
@@ -1,10 +1,10 @@ LICENSE = "GPL"
DESCRIPTION = "SysV init scripts"
SECTION = "base"
PRIORITY = "required"
DEPENDS = "makedevs"
RDEPENDS = "makedevs"
LICENSE = "GPL"
-PR = "r99"
+PR = "r100"
SRC_URI = "file://functions \
file://halt \
More information about the Openembedded-commits
mailing list