diff options
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 |