diff options
author | Tom Gundersen <teg@jklm.no> | 2011-06-05 19:15:20 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2011-06-05 19:37:38 +0200 |
commit | 3b1d78bc524724ed49ac000d85f477876ccfc794 (patch) | |
tree | 5de4dbcdc287a04ec88d825a2bbcca1bb5aa89ad /rc.sysinit | |
parent | 3e874cfd73e0cb70abd568c5b070ff85609af3a4 (diff) |
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 <teg@jklm.no>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-x | rc.sysinit | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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 |