Index: usr.sbin/tzsetup/tzsetup.8 =================================================================== --- usr.sbin/tzsetup/tzsetup.8 +++ usr.sbin/tzsetup/tzsetup.8 @@ -59,7 +59,7 @@ .It Fl r Reinstall the zoneinfo file installed last time. The name is obtained from -.Pa /var/db/zoneinfo . +.Pa /etc/timezone . .It Fl s Skip the initial question about adjusting the clock if not set to .Tn UTC . @@ -109,6 +109,8 @@ .It Pa /etc/wall_cmos_clock see .Xr adjkerntz 8 +.It Pa /etc/timezone +saved name of the timezone file installed last .It Pa /usr/share/misc/iso3166 mapping of .Tn ISO @@ -118,7 +120,7 @@ .It Pa /usr/share/zoneinfo/zone.tab mapping of timezone file to country and location .It Pa /var/db/zoneinfo -saved name of the timezone file installed last +legacy path for saved timezone name .El .Sh EXAMPLES Normal usage, to select the right zoneinfo file via the dialog-based @@ -136,7 +138,7 @@ .Pp After a reinstall of the zoneinfo files, you can reinstall the latest installed zoneinfo file (as specified in -.Pa /var/db/zoneinfo ) : +.Pa /etc/timezone ) : .Dl "tzsetup -r" .Sh SEE ALSO .Xr date 1 , Index: usr.sbin/tzsetup/tzsetup.c =================================================================== --- usr.sbin/tzsetup/tzsetup.c +++ usr.sbin/tzsetup/tzsetup.c @@ -58,7 +58,8 @@ #define _PATH_ISO3166 "/usr/share/misc/iso3166" #define _PATH_ZONEINFO "/usr/share/zoneinfo" #define _PATH_LOCALTIME "/etc/localtime" -#define _PATH_DB "/var/db/zoneinfo" +#define _PATH_DB "/etc/timezone" +#define _PATH_DB_COMPAT "/var/db/zoneinfo" #define _PATH_WALL_CMOS_CLOCK "/etc/wall_cmos_clock" #ifdef PATH_MAX @@ -77,7 +78,8 @@ static char path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN], path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], - path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN]; + path_db[MAXPATHLEN], path_db_compat[MAXPATHLEN], + path_wall_cmos_clock[MAXPATHLEN]; static int reallydoit = 1; static int reinstall = 0; @@ -845,6 +847,7 @@ strcpy(path_zoneinfo, _PATH_ZONEINFO); strcpy(path_localtime, _PATH_LOCALTIME); strcpy(path_db, _PATH_DB); + strcpy(path_db_compat, _PATH_DB_COMPAT); strcpy(path_wall_cmos_clock, _PATH_WALL_CMOS_CLOCK); } else { sprintf(path_zonetab, "%s/%s", chrootenv, _PATH_ZONETAB); @@ -852,6 +855,7 @@ sprintf(path_zoneinfo, "%s/%s", chrootenv, _PATH_ZONEINFO); sprintf(path_localtime, "%s/%s", chrootenv, _PATH_LOCALTIME); sprintf(path_db, "%s/%s", chrootenv, _PATH_DB); + sprintf(path_db_compat, "%s/%s", chrootenv, _PATH_DB_COMPAT); sprintf(path_wall_cmos_clock, "%s/%s", chrootenv, _PATH_WALL_CMOS_CLOCK); } @@ -861,24 +865,27 @@ if (reinstall == 1) { FILE *f; + char **p, *db_paths[] = {path_db, path_db_compat, NULL}; char zoneinfo[MAXPATHLEN]; - if ((f = fopen(path_db, "r")) != NULL) { - if (fgets(zoneinfo, sizeof(zoneinfo), f) != NULL) { - zoneinfo[sizeof(zoneinfo) - 1] = 0; - if (strlen(zoneinfo) > 0) { - zoneinfo[strlen(zoneinfo) - 1] = 0; - rv = install_zoneinfo(zoneinfo); - exit(rv & ~DITEM_LEAVE_MENU); + for (p = db_paths; *p != NULL; p++) { + if ((f = fopen(*p, "r")) != NULL) { + if (fgets(zoneinfo, sizeof(zoneinfo), f) != NULL) { + zoneinfo[sizeof(zoneinfo) - 1] = 0; + if (strlen(zoneinfo) > 0) { + zoneinfo[strlen(zoneinfo) - 1] = 0; + rv = install_zoneinfo(zoneinfo); + exit(rv & ~DITEM_LEAVE_MENU); + } + errx(1, "Error reading %s.\n", *p); } - errx(1, "Error reading %s.\n", path_db); + fclose(f); + errx(1, "Unable to determine earlier installed " + "zoneinfo name. Check %s", *p); } - fclose(f); - errx(1, - "Unable to determine earlier installed zoneinfo " - "name. Check %s", path_db); } - errx(1, "Cannot open %s for reading. Does it exist?", path_db); + errx(1, "Cannot open %s or %s for reading.", path_db, + path_db_compat); } /*