geoip: add quiet flag to xt_geoip_build
PATCH 1/1 geoip: add quiet flag to xt_geoip_build
From: Philip Prindeville <[email protected]>
Conceivably someone might want to run a refresh of the geoip database from within a script, particularly an unattended script such as a cron job. Don't generate output in that case.
--- geoip/xt_geoip_build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
geoip/xt_geoip_build +6 -3
@@ -17,11 +17,14 @@ my $csv = Text::CSV_XS->new({ binary => 1, eol => $/, }); # or Text::CSV + +my $quiet = 0; my $source_dir = "."; my $target_dir = "."; &Getopt::Long::Configure(qw(bundling)); &GetOptions( + "q" => \$quiet, "D=s" => \$target_dir, "S=s" => \$source_dir, );
@@ -63,12 +66,12 @@ sub collect $country{$cc}->{pool_v6}->add_range($range); } - if ($. % 4096 == 0) { + if (!$quiet && $. % 4096 == 0) { print STDERR "\r\e[2K$. entries"; } } - print STDERR "\r\e[2K$. entries total\n"; + print STDERR "\r\e[2K$. entries total\n" unless ($quiet); close($fh);
@@ -106,7 +109,7 @@ sub writeCountry printf "%5u IPv%s ranges for %s\n", scalar(@ranges), ($family == AF_INET ? '4' : '6'), - $iso_code; + $iso_code unless ($quiet); my $file = "$target_dir/".uc($iso_code).".iv".($family == AF_INET ? '4' : '6'); if (!open($fh, '>', $file)) {
Signature · 1 line
2.17.2
Quoted 5 lines · Philip Prindeville
From: Philip Prindeville <[email protected]>
Conceivably someone might want to run a refresh of the geoip database from within a script, particularly an unattended script such as a cron job. Don't generate output in that case.
added.
Quoted 12 lines · Jan Engelhardt
Quoted 5 lines · Philip Prindeville
From: Philip Prindeville <[email protected]>
Conceivably someone might want to run a refresh of the geoip database from within a script, particularly an unattended script such as a cron job. Don't generate output in that case.
added.
Thanks.
BTW, when is 3.10 due out?
Xtables-addons 3.10 (Re: [PATCH 1/1] geoip: add quiet flag to xt_geoip_build)
Quoted 8 lines · Philip Prindeville
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · Philip Prindeville
Conceivably someone might want to run a refresh of the geoip database from within a script, particularly an unattended script such as a cron job. Don't generate output in that case.
BTW, when is 3.10 due out?
I have tagged 3.10 and produced the tarballs.
Take note that the homepage etc. has moved to
https://inai.de/projects/xtables-addons/
Downloads, new git location, and redirects from sf.net should be all there.
Re: Xtables-addons 3.10 (Re: [PATCH 1/1] geoip: add quiet flag to xt_geoip_build)
Quoted 14 lines · Jan Engelhardt
Quoted 8 lines · Philip Prindeville
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · Philip Prindeville
Conceivably someone might want to run a refresh of the geoip database from within a script, particularly an unattended script such as a cron job. Don't generate output in that case.
BTW, when is 3.10 due out?
Quoted 7 lines
I have tagged 3.10 and produced the tarballs.
Take note that the homepage etc. has moved tohttps://inai.de/projects/xtables-addons/
Downloads, new git location, and redirects from sf.net should be all there.
Awesome. Thanks!