Re: /etc/localtime problems



On Sun, Oct 30, 2011 at 03:10:23PM +0400, Lev Serebryakov wrote:
Now, /etc/localtime is copy of one of files from
/usr/share/zoneinfo. It is created at install time or with "tzsetup"
utility.

IMHO, it is bad practice. For example, Russia changed rules
(cancelled Winter Time). Ok, our database was updated properly
(r223629 and MFCes), but "make buildworld installworld && mergemaster"
doesn't touch /etc/localtime! So, every administrator of every FreeBSD
server in Russia needs not to forget to update this file manually.

It looks not good.

IMHO, /etc/localtime should be symlink (in such case "installworld"
or "freebsd-update" will fix problem), or "mergemaster" should know
about this file and update it too...

Recent tzsetup(8) (in 10.x, 9.x and recent 8.x but not in any release)
stores the choice in /var/db/zoneinfo, allowing "tzsetup -r" to install
the new version of the previous time zone. This happens automatically on
installworld, but for some reason not on freebsd-update install.
However, this only works if the new tzsetup(8) was run at least once to
select the time zone (there is no code to create /var/db/zoneinfo from
which /usr/share/zoneinfo file matches /etc/localtime).

Code to create /var/db/zoneinfo could be something like

if [ ! -s /var/db/zoneinfo ] && [ -s /etc/localtime ]; then
zone=$(cd /usr/share/zoneinfo && for z in */* */*/* *; do
if cmp -s "$z" /etc/localtime; then echo "$z"; break; fi done)
if [ -n "$zone" ]; then echo "$zone" >/var/db/zoneinfo; fi
fi

It should be run against the old /usr/share/zoneinfo and assumes the
/etc/localtime is up-to-date against that.

--
Jilles Tjoelker
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • 8.3-RC2 Available...
    ... The ISO images and, for architectures that support it, the memory stick ... The dvd images include all of the documentation packages as ... systems running earlier FreeBSD releases. ...
    (freebsd-stable)
  • 7.3-RC1 Available...
    ... Packages were included for amd64 and i386 architectures ... or 7.3-BETA1 can upgrade as follows: ... FreeBSD Update may ask the user to help by merging ...
    (freebsd-stable)
  • 7.3-RC2 Available...
    ... The target schedule as well as the current status of the ... ISO images for the architectures listed above are available on the FTP ... FreeBSD Update may ask the user to help by merging ...
    (freebsd-stable)
  • FreeBSD 8.2-RC3/7.4-RC3 Available...
    ... An initial set of pre-built packages are available on the 8.2-RC3 ... DVD images for both amd64 and i386. ... FreeBSD Update may ask the user to help by merging ...
    (freebsd-stable)
  • FreeBSD 8.3-BETA1 Available...
    ... The first BETA build of the 8.3-RELEASE release cycle is now available ... on the FTP servers for the amd64, i386, and pc98 architectures. ... systems running earlier FreeBSD releases. ...
    (freebsd-stable)