[pve-devel] [PATCH installer] fix #4430: add UTC timezone as option to installer

Christoph Heiss c.heiss at proxmox.com
Wed Mar 15 13:26:36 CET 2023


The 'Etc/UTC' timezone does not have a definite 2-letter country code
assigned. 'xx' was choosen on the basis that this hopefully will never
be assigned to any real country in the future, but a small collision
check won't hurt either.

This also means it does not have an entry in either the ISO-codes
definition file nor the zoneinfo table, thus needing to define it
manually.

Using just 'UTC' as timezone (name) also matches what PVE/PMG/PBS do in
their UI.

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
Some bike-shedding: If there is a better suggestion on what country code
to choose, I'll happily change it.

Also, although the correct timezone name is 'Etc/UTC', I chose 'UTC' as
"country name" to display in the installer to make it easier to find for
users, as they probably will just type 'UTC' in there at first, rather
than 'Etc'.

 country.pl  | 4 ++++
 proxinstall | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/country.pl b/country.pl
index b1a2d62..ffa47d2 100755
--- a/country.pl
+++ b/country.pl
@@ -72,3 +72,7 @@ foreach my $cc (sort keys %$country) {
     my $mir = $mirrors->{$cc} || '';
     print "$cc:$country->{$cc}:$map:$mir:\n";
 }
+
+die "UTC fake country code collision: $country->{xx}\n"
+    if defined($country->{xx});
+print "xx:UTC:::\n";
diff --git a/proxinstall b/proxinstall
index 79abc34..9000178 100755
--- a/proxinstall
+++ b/proxinstall
@@ -690,6 +690,10 @@ sub read_cmap {
     }
     close ($TMP);

+    $cczones->{xx}->{UTC} = 1;
+    $country->{xx}->{zone} = 'UTC';
+    $zones->{UTC} = 1;
+
     return {
 	zones => $zones,
 	cczones => $cczones,
--
2.39.2






More information about the pve-devel mailing list