diff options
author | Tom Gundersen <teg@jklm.no> | 2012-07-03 00:46:19 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2012-07-03 00:52:33 +0200 |
commit | 6f3b4c5edc6dfdd301d80929cb35e316fa742144 (patch) | |
tree | 95f8f8ef918a96ce86b5910bcc5324547410eee0 /rc.sysinit | |
parent | 267d36a1c80a69342d9dda264b4b60f656ea20cf (diff) |
hwclock: warn on discrepancy between /etc/adjtime and /etc/rc.conf about the timezone of the RTC
Also, move from /var/lib/hwclock/adjtime to /etc/adjtime. This must be fixed in util-linux too.
Signed-off-by: Tom Gundersen <teg@jklm.no>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-x | rc.sysinit | 31 |
1 files changed, 23 insertions, 8 deletions
@@ -50,16 +50,17 @@ esac if [[ $HWCLOCK_PARAMS ]]; then stat_busy "Adjusting system time and setting kernel timezone" - # Adjust the system time for timezone offset if rtc is not in UTC - # 1. Make creation time on device nodes sane (FS#8665) - # 2. Filesystem checks can depend on system time - # 3. This also sets the kernel time zone, used by e.g. vfat - # If TIMEZONE is not set in rc.conf, the timezone stored in /etc/localtime - # is used. If HARDWARECLOCK is not set in rc.conf, the value in - # /var/lib/hwclock/adjfile is used (in this case /var can not be a separate - # partition). + # Adjust the system time for timezone offset if rtc is not in UTC, as + # filesystem checks can depend on system time. This also sets the kernel + # time zone, used by e.g. vfat. + # If TIMEZONE is not set in rc.conf, the timezone stored in /etc/localtime + # is used. If HARDWARECLOCK is not set in rc.conf, the value in + # /etc/adjfile is used. + [[ $TIMEZONE ]] && export TZ=$TIMEZONE + hwclock $HWCLOCK_PARAMS && stat_done || stat_fail + unset TZ fi @@ -148,6 +149,20 @@ stat_busy "Saving dmesg Log" fi (( $? == 0 )) && stat_done || stat_fail +if [[ -f /etc/adjtime ]]; then + ( read ; read ; read ADJTIME) < /etc/adjtime + + if [[ $ADJTIME == 'LOCAL' ]]; then + if [[ $HARDWARECLOCK == 'UTC' ]]; then + printf "${C_FAIL}/etc/rc.conf says the RTC is in UTC, but /etc/adjtime says it is in localtime.\n${C_OTHER}." + fi + else + if [[ $HARDWARECLOCK == 'LOCALTIME' ]]; then + printf "${C_FAIL}/etc/rc.conf says the RTC is in localtime, but hwclock (/etc/adjtime) thinks it is in UTC.\n${C_OTHER}." + fi + fi +fi + run_hook sysinit_end # End of file |