]>
git.proxmox.com Git - pve-installer.git/blob - country.pl
10 my $country_codes_file = "/usr/share/iso-codes/json/iso_3166-1.json";
12 my $iso_3166_codes = from_json
(PVE
::Tools
::file_get_contents
($country_codes_file, 64 * 1024));
14 my $country = { map { lc($_->{'alpha_2'}) => $_->{'common_name'} // $_->{'name'} } @{$iso_3166_codes->{'3166-1'}} };
16 # we need mappings for X11, console, and kvm vnc
18 # LC(-LC)? => [DESC, kvm, console, X11, X11variant]
19 my $keymaps = PVE
::Tools
::kvmkeymaps
();
21 foreach my $km (sort keys %$keymaps) {
22 my ($desc, $kvm, $console, $x11, $x11var) = @{$keymaps->{$km}};
24 if ($km =~m/^([a-z][a-z])-([a-z][a-z])$/i) {
25 defined ($country->{$2}) || die "undefined country code '$2'";
27 defined ($country->{$km}) || die "undefined country code '$km'";
30 $x11var = '' if !defined ($x11var);
31 print "map:$km:$desc:$kvm:$console:$x11:$x11var:\n";
40 'nl' => 'en-us', # most Dutch people us US layout
65 my $mirrors = PVE
::Tools
::debmirrors
();
66 foreach my $cc (keys %$mirrors) {
67 die "undefined country code '$cc'" if !defined ($country->{$cc});
70 foreach my $cc (sort keys %$country) {
71 my $map = $defmap->{$cc} || '';
72 my $mir = $mirrors->{$cc} || '';
73 print "$cc:$country->{$cc}:$map:$mir:\n";