Keeping /etc/localtime up-to-date

Maxim Khitrov max at mxcrypt.com
Mon Mar 28 18:45:19 UTC 2011


On Mon, Mar 28, 2011 at 2:10 PM, Garrett Cooper <gcooper at freebsd.org> wrote:
> On Mon, Mar 28, 2011 at 10:57 AM,  <dieterbsd at engineer.com> wrote:
>>> And while I (think I) recall that the equivalent of /etc/localtime
>>> was implemented in some version of SunOS many years ago as a symlink,
>>> I believe that approach could be problematic for FreeBSD, as it
>>> could impose some unintended requirements on some of the start-up
>>> scripts.
>>
>> I have been running FreeBSD and NetBSD with /etc/localtime being
>> a symlink for years and have not seen any problems as a result.
>
> +1. Many Linux distros do the same thing as well (Gentoo is just one example).
> Thanks,
> -Garrett

Same here, though I'd be happy to change this habit if mergemaster
handled the updates for me.

If you do end up using /var/db/zoneinfo in mergemaster, keep two things in mind:

1. /var/db/zoneinfo may not exist because tzsetup was never used
(/etc/localtime may or may not exist).
2. /etc/localtime may be a symlink to /usr/share/zoneinfo/...

In the first case, you would need to ask the user which zoneinfo file
to use, or just run tzsetup for them. In the second case, you should
confirm that the user wants to replace the symlink with a copy. In
both cases, verify that /var/db/zoneinfo reflects current
configuration (create it, if necessary).

- Max


More information about the freebsd-hackers mailing list