From ac55830ea6cfa2c130275ebd6b4f2c0fea80130e Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sat, 25 Jun 2011 00:53:05 +0200 Subject: hwclock: use correct timezone To avoid setting the kernel timezone with an out-of-date /etc/localtime, we pass TZ directly to hwclock. Also document how TIMEZONE and HARDWARECLOCK are optional in rc.conf Signed-off-by: Tom Gundersen --- rc.conf | 4 +++- rc.sysinit | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/rc.conf b/rc.conf index b217ddb..9700480 100644 --- a/rc.conf +++ b/rc.conf @@ -11,8 +11,10 @@ # startup and during the boot process. If set to 'no', the C locale is used. # HARDWARECLOCK: set to "", "UTC" or "localtime", any other value will result # in the hardware clock being left untouched (useful for virtualization) -# Note: Using "localtime" is discouraged. +# Note: Using "localtime" is discouraged, using "" makes hwclock fall back +# to the value in /var/lib/hwclock/adjfile # TIMEZONE: timezones are found in /usr/share/zoneinfo +# Note: if unset, the value in /etc/localtime is used unchanged # KEYMAP: keymaps are found in /usr/share/kbd/keymaps # CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US) # CONSOLEMAP: found in /usr/share/kbd/consoletrans diff --git a/rc.sysinit b/rc.sysinit index 3773beb..0fca20e 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -62,11 +62,12 @@ if [[ $HWCLOCK_PARAMS ]]; then # 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 - # configured timezone. Any new timezone put in rc.conf is copied over at - # a later time. - # This also sets the kernel time zone. - [[ -f /etc/localtime ]] && hwclock $HWCLOCK_PARAMS + # 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). + TZ=$TIMEZONE && hwclock $HWCLOCK_PARAMS fi # Start/trigger UDev, load MODULES and settle UDev -- cgit v1.2.3