Currently we wait until after the base system has been extracted (and a
few other bits of config have occurred) until we configure these. This
means that we risk having the wrong time for files written to the
installed system in this period, and because we don't do anything to set
the live system's time zone the time zone used for displaying to the
user will vary between running inside and outside the chroot. Moreover,
when downloading distribution sets or pkgbase packages, HTTPS requires
an accurate clock for certificate validity checks, and so we really need
to set the current time first.
Instead, split the current step into two. The first half is to set the
time zone and time of the live system, almost exactly as we previously
did for the installed system, except using a new /tmp/bsdinstall_tz for
tzsetup (as we don't yet have the installed system to chroot to, and the
live system has a read-only root filesystem). We symlink the various
corresponding files on the live media's root filesystem to point here so
that this affects the live system's time zone.
The second half is to save this config to the installed system, as
previously happened by virtue of running tzsetup chroot'ed there.
We also introduce a new time script that wraps running both of those to
effectively provide the same end behaviour as before (except also
setting the live system's time zone). This is used by finalconfig if the
user selects the "Time Zone" option, but also provides backwards
compatibility for any existing scripted installation scripts.