X-Git-Url: https://git.openstreetmap.org./dns.git/blobdiff_plain/ab87b76a531e2a1d7628e8e7e72c51de25cac7da..c56a2f4216218c5d0c1cb78206aed695b2a4b2e1:/bin/mkgeo diff --git a/bin/mkgeo b/bin/mkgeo index 27876b8..77b44d9 100755 --- a/bin/mkgeo +++ b/bin/mkgeo @@ -230,10 +230,13 @@ foreach my $origin (sort { $a->{name} cmp $b->{name} } values %$origins) $clon = $clon + 360; } - $zonefile->print("# $origin->{name}\n"); - $zonefile->print("C\L$origin->{code}\E.${zone}:$cluster->{name}.${zone}:600\n"); + if (!defined($gdnsname)) + { + $zonefile->print("# $origin->{name}\n"); + $zonefile->print("C\L$origin->{code}\E.${zone}:$cluster->{name}.${zone}:600\n"); - $jszonefile->print(" CNAME(\"\L$origin->{code}\E.${jszone}\", \"$cluster->{name}.${zone}.\", TTL(\"10m\")),\n"); + $jszonefile->print(" CNAME(\"\L$origin->{code}\E.${jszone}\", \"$cluster->{name}.${zone}.\", TTL(\"10m\")),\n"); + } push @json, { type => "Feature", @@ -251,21 +254,25 @@ foreach my $origin (sort { $a->{name} cmp $b->{name} } values %$origins) $targetorigins->{$cluster->{name}}->{bandwidth} += $origin->{bandwidth}; } -# Header for default records -$zonefile->print("# Unknown origins\n"); - -# Output default records for IPs that can't be mapped to a country -foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters) +# Skip default records if we don't need them +if (!defined($gdnsname)) { - my $name = $cluster->{name}; + # Header for default records + $zonefile->print("# Unknown origins\n"); - if (my $default = $cluster->{default}) - { - output_server($zonefile, $jszonefile, "${default}.${zone}", "${default}.${jszone}", $cluster); - } - elsif (exists($cluster->{default})) + # Output default records for IPs that can't be mapped to a country + foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters) { - output_server($zonefile, $jszonefile, "${zone}", "${jszone}", $cluster); + my $name = $cluster->{name}; + + if (my $default = $cluster->{default}) + { + output_server($zonefile, $jszonefile, "${default}.${zone}", "${default}.${jszone}", $cluster); + } + elsif (exists($cluster->{default})) + { + output_server($zonefile, $jszonefile, "${zone}", "${jszone}", $cluster); + } } }