From 3b1d78bc524724ed49ac000d85f477876ccfc794 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sun, 5 Jun 2011 19:15:20 +0200 Subject: hwclock: allow TZ to be set in adjtime, only adjust for TZ during boot This allows HARDWARECLOCK to be removed from rc.conf, if you want to rely on /var/lib/hwclock/adjtime (or wherever the file ends up in the future). It assumes the relevant path is on the rootfs. Furthermore, we can assume (since kernel2.6.??) that the rtc modules set the time from rtc themselves, so our job is just to adjust the tz. (FWIW, this coincides with what systemd does). To get the old behavior of not touching the rtc, set it to anything anything else. We should probably have chosen a syntax for this, like IGNORE. Maybe another time... Signed-off-by: Tom Gundersen --- rc.sysinit | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'rc.sysinit') diff --git a/rc.sysinit b/rc.sysinit index b2b0943..7b42388 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -43,10 +43,11 @@ findmnt / --options ro &>/dev/null || minilogd bootlogd -p /run/bootlogd.pid -HWCLOCK_PARAMS="--hctosys" +HWCLOCK_PARAMS="--systz" case $HARDWARECLOCK in - UTC) HWCLOCK_PARAMS+=" --utc";; - localtime) HWCLOCK_PARAMS+=" --localtime";; + "") ;; + UTC) HWCLOCK_PARAMS+=" --utc --noadjfile";; + localtime) HWCLOCK_PARAMS+=" --localtime --noadjfile";; *) HWCLOCK_PARAMS="";; esac @@ -63,7 +64,7 @@ if [[ $HWCLOCK_PARAMS ]]; then done fi - # Do a clock set here for a few reasons: + # Adjust the system time for timezone offset if rtc is not in UTC # 1. Make creation time on udev nodes sane (FS#8665) # 2. Filesystem checks can depend on system time # 3. This will set the clock, if using non-UTC, off the last known @@ -72,7 +73,7 @@ if [[ $HWCLOCK_PARAMS ]]; then # This does *NOT* take into account a time adjustment file as /var may not be # mounted yet. A second set may occur in rc.d/hwclock to match rc.conf. if [[ -f /etc/localtime ]]; then - hwclock $HWCLOCK_PARAMS --noadjfile + hwclock $HWCLOCK_PARAMS fi fi -- cgit v1.2.3