Commit graph

149 commits

Author SHA1 Message Date
Ed Maste 40b57cb616 tzsetup: be explicit about *timezone* abbreviation
During the install process tzsetup asks a question like

    Does the abbreviation `EDT' look reasonable?

The installer asks lots of questions, some that relate to the previous
screen or topic and some that do not.  A new user installed FreeBSD for
the first time and was confused by this question, not realizing that it
was asking whether the abbreviation is correct for the selected
timezone.

Reviewed by:	bapt, brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44500
2024-04-16 09:55:46 -04:00
Ed Maste 5e16809c95 tzsetup: symlink /etc/localtime instead of copying
Using a symlink means that new timezone data (installed by an errata
update, say) will be usable without having to be copied again.

Reviewed by:	bapt, kevans, philip
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37005
2023-11-23 21:13:49 -05:00
Brooks Davis 6f7c45056f tzsetup: make UTC the first (default) region
Many sysadmins prefer to configure their systems to UTC and it's a
reasonable default when installing, making it easier to get a usable
system by just hitting <return> repeatidly.

Renumber UTC to 0 to preserve the finger memory of those selecting a
region by shortcut.

Reviewed by:	jrtc27, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42383
2023-10-30 23:35:21 +00:00
Pierre Pronchery 914ab28c59 tzsetup: add support for countries in two continents
This supports countries located across multiple continents, as per the
zone1970.tab file. This only affects Cyprus and Türkiye at the moment.

PR:		236874
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41306
2023-10-13 13:23:59 -04:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Yuri Pankov bb255cee93 tzsetup: fix "misleading indentation" warning with -DVERBOSE 2023-07-26 12:33:42 +02:00
Yuri Pankov 08ed87514f tzsetup: appease checkstyle9 2023-04-27 20:29:55 +02:00
Yuri Pankov cfd0217aa9 tzsetup: adopt zone1970.tab changes
- assumption that single-zone countries do not have description
  is no longer correct; do not try to optimize this case as it's
  only going to make the code more confusing and we now have menus
  with a single zone selection because of this
- remove the single-country continent short cut, it also only serves
  to confuse users as we now have such a continent
- instead add a single-zone contry short cut (see above), now all
  single-zone countries fall here
- use the #@ continent overrides that zone1970.tab introduces (this is
  visible at least fixing Iceland being currently listed under Africa)
- add Arctic Ocean "continent" coming only from the overrides at the
  moment
- update baseline with the changes

Reviewed by:	bapt, philip
Differential Revision:	https://reviews.freebsd.org/D39606
2023-04-27 19:31:48 +02:00
Yuri Pankov 989a0e1d81 tzsetup: fix bootstrapping for github CI jobs
Move dump_zonetab() under HAVE_BSDDIALOG as the parsing code
it relies on already is.
2023-04-26 14:29:08 +02:00
Yuri Pankov 336c4682b6 tzsetup: add baseline file to control parsed zonetab contents
Introduce undocumented option -d to dump parsed zonetab file contents
and add a "baseline" target along with instructions on updating it.

Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D39634
2023-04-23 10:32:02 +02:00
Yuri Pankov 4fee5114c3 tzsetup(8): update paths to zone tab and tzdata source
tzsetup now uses zone1970.tab and zoneinfo source is located in
contrib/tzdata, update the man page accordingly.

While here, drop obsolete Tn macros and insert vertical breaks (mostly
before Dl in examples) to improve readability.

Reviewed by:	pauamma_gundo.com (manpages)
Differential Revision:	https://reviews.freebsd.org/D39643
2023-04-19 13:56:58 +02:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Baptiste Daroussin 5876499023 tzsetup: remove left overs from libbsddialog conversion
PR:	265954
2022-08-26 11:54:17 +02:00
Alfonso S. Siciliano 94cb21cda6
tzsetup(8): Refactoring to delete dialog(3) code
Little refactoring to complete the conversion to bsddialog(3),
not functional changes:

 * Delete: remaining code for autosizing using BSDDIALOG_AUTOSIZE.
 * Add: constants to delete magical numbers and to avoid unclear
   returned values.
 * Delete: redundant 'conf.button.default_cancel=false', performed by
   bsddialog_initconf().
 * Add: a new function message_zoneinfo_file() to merge features.

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34862
2022-04-12 00:38:40 +02:00
Alfonso Siciliano 263660c061 bsddialog: import version 0.1
Import bsddialog 0.1 Utility and Library, fully refatorized, API stable,
manuals completed, easier to maintain and improve.

Update deps for new API:
add mixedgauge consts, delete __DECONST and add bsddialog_geterror()
info to avoid silent errors

* tzsetup
* kbdmap
* distextract

Differential Revision:	https://reviews.freebsd.org/D34066
2022-01-28 09:56:21 +01:00
Alfonso Siciliano be0236ebd8 tzsetup: Fix unicode support
Differential revision:	https://reviews.freebsd.org/D33532
2021-12-17 09:25:07 +01:00
Alfonso Siciliano 0a7e19b30f tzsetup: adapt for libbsddialog 0.0.1
libbsdialog 0.0.1 provides:
* bsddialog_conf.auto_minwidth:
* menurows is variable with autosize (properly defines max menurows)

Then tzsetup can use BSDDIALOG_AUTOSIZE keeping the dialog behavior:
min 24 cols, max 16 menurows

Differential revision:	https://reviews.freebsd.org/D33397
2021-12-13 09:07:47 +01:00
Emmanuel Vadot 547fc67fec tzsetup: Default to UTC
Restore old behavior.

Fixes:	f872dde34c ("tzsetup: replace libdialog with libbsddialog")

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D33334
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2021-12-08 14:39:00 +01:00
Baptiste Daroussin f499134dd4 bsddialog: import snapshot 2021-12-05 2021-12-06 11:43:34 +01:00
Baptiste Daroussin 6ea39dd6c7 tzsetup: remove dedundant declaration 2021-11-24 11:12:05 +01:00
Baptiste Daroussin f872dde34c tzsetup: replace libdialog with libbsddialog
Reviewed by: alfix86_gmail.com (bsddialog author)
Differential Revision: https://reviews.freebsd.org/D33077
2021-11-24 11:03:33 +01:00
Baptiste Daroussin cbc83e378a ncurses: chase dependency changes in the source tree
Differential Revision:	https://reviews.freebsd.org/D32098
2021-10-04 11:38:24 +02:00
Alex Richardson 03266a2f08 Don't link against libdialog/ncurses when bootstrapping tzsetup 2020-08-07 16:04:10 +00:00
Warner Losh 7047dceee3 Remove sparc64 ifdef
Now we default to setting the hardware clock to UTC
everywhere. sparc64 was the old odd-man out before.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:41 +00:00
Simon J. Gerraty 2c9a9dfc18 Update Makefile.depend files
Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494
2019-12-11 17:37:53 +00:00
Simon J. Gerraty 5ab1c5846f Add Makefile.depend.options
Leaf directories that have dependencies impacted
by options need a Makefile.depend.options file
to avoid churn in Makefile.depend

DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc
can be set in local.dirdeps-options.mk
which can add to those set in Makefile.depend.options

See share/mk/dirdeps-options.mk

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22469
2019-12-11 17:37:37 +00:00
Thomas Munro 513419f404 tzsetup: upgrade to zone1970.tab
zone.tab is deprecated.  Install zone1970.tab alongside it, and use it
for tzsetup(8).  This is also useful for other applications that need
the modern better maintained file.

Reviewed by: philip
Approved by: allanjude (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20646
2019-07-17 06:17:27 +00:00
Xin LI 963aa85d2a In read_zones(), check if the file name actually fit in the buffer
and make sure it would terminate with nul with strlcpy().

Reviewed by:	imp (earlier revision)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16595
2018-08-09 02:47:22 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Marius Strobl eabfbad050 Revert the parts of r322097 related to /etc/wall_cmos_clock handling as
the previous behavior actually is required for setting up configurations
in which the RTC is using UTC but the timezone is not. Still, besides
uniform error handling, that file should get the same treatment in the
non-interactive variants supported by tzsetup(8).
2017-08-07 21:38:10 +00:00
Marius Strobl 4b38286169 - Move creation and unlinking of /etc/wall_cmos_clock from the handling
of the initial UTC dialog to install_zoneinfo() so that file gets the
  necessary treatment also when that dialog is skipped via "-s", when
  selecting UTC from the time zone menu or on the command-line instead
  etc.
- Make the initial UTC dialog actually work by giving the relevant files
  the necessary treatment and then exit when choosing "Yes" there instead
  of moving on to the time zone menu regardless.
- Since r301131, /etc/localtime is also installed when selecting UTC in
  interactive configurations (which previously meant only via the time
  zone menu, though). Thus, the code added in r230298 which treats a
  NULL zone file name as UTC and removes /etc/localtime in that case can
  go again.
- Consistently refer to "could not delete" (as chosen by the oldest such
  code in here) when unlink(2) fails instead of a to mixture of "delete"
  and "unlink" in error messages.
2017-08-05 12:59:03 +00:00
Enji Cooper eca186c4c2 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:23:53 +00:00
Baptiste Daroussin 4fe54d4279 Fix build of tzsetup when WITHOUT_DIALOG is set
Hide dialog specific code behind HAVE_DIALOG. It allows to build a stripped
down version (missing the dialog UI) but perfectly function tzsetup when
world is built WITHOUT_DIALOG

Reorganise a bit the code to limit the number of blocks under HAVE_DIALOG

Reviewed by:	emaste
Sponsored by:	https://reviews.freebsd.org/D8325
2016-10-22 22:35:39 +00:00
Steven Hartland dc30160e1a Fix tzsetup not installing /etc/localtime for UTC
If tzsetup UTC is run then it successfully configured the system for UTC
including installing /etc/localtime however if the user ran just tzsetup
for interactive configuration and select UTC no /etc/localtime was installed
which resulted in failures for utilities which require said file.

Change set_zone_utc to call install_zoneinfo("UTC") to ensure that
/etc/localtime is created for interactive UTC selection.

Users who have previously run tzsetup in interactive mode and select UTC
can install the missing /etc/localtime by running tzsetup -r.

Also correct static miss-match for set_zone_utc.

MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	Multiplay
2016-06-01 15:39:11 +00:00
Don Lewis ee67f7cc77 Avoid buffer overflow or truncation when constructing path_zoneinfo_file.
Reported by:	Coverity
CID:		1011160
MFC after:	1 week
2016-05-26 01:45:04 +00:00
Marcelo Araujo b916534496 Use NULL instead of 0 for pointers.
fgetln(3) will returns NULL if cannot get a line from a stream.
strsep(3) it will returns NULL if the end of the string was reached.
jemalloc(3) malloc will returns NULL if it cannot allocate memory.
fgetln(3) it will returns NULL if it cannot get a line from a stream.

MFC after:	4 weeks
2016-04-15 04:10:47 +00:00
Xin LI 427c435f64 Revert r289269 for now. After looking at share/zoneinfo/Makefile this could
potentially break non-root installs and we need a better solution, probably
by doing it differently when no UI is involved.
2015-10-27 01:26:50 +00:00
Xin LI a2668e8128 Use chroot(2) instead of using prefixes for files.
Previously, the code prefixes the chroot path to actual file paths to
simulate the effect.  This, however, will not work for tzset(3) which
expects the current system have a working set of timezone data files,
and that is not always the case.

This changeset simplifies the handling of paths and use an actual
chroot(2) call to implement the effect.

PR:		bin/197313
MFC after:	2 weeks
2015-10-13 22:55:17 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty 98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Eitan Adler b1abc63706 tzsetup: remove set but unused variable
- leave a comment explaining which variable it used to be

Reported by:	gcc5.1
2015-04-19 08:45:37 +00:00
Baptiste Daroussin c6db8143ed Convert usr.sbin to LIBADD
Reduce overlinking
2014-11-25 16:57:27 +00:00
Simon J. Gerraty 9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Devin Teske 7e31e02573 Fix whitespace.
Thanks to:	nwhitehorn
2014-11-11 19:45:14 +00:00
Devin Teske e91afc1cda Default bsdconfig timezone' and tzsetup' to `-s' in a VM.
Recommended by:	cperciva
Reviewed by:	cperciva
Relnotes:	tzsetup and bsdconfig now assume that the "hardware" clock inside a VM is set to UTC
2014-11-11 19:37:17 +00:00
Simon J. Gerraty ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Simon J. Gerraty fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00