mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 14:55:36 +03:00
Fix GeoIP2 database file extraction (#764)
This commit is contained in:
parent
0bd69445f9
commit
7a44e6ec66
@ -7,7 +7,7 @@ use File::Basename;
|
|||||||
use File::stat;
|
use File::stat;
|
||||||
use File::Temp qw/ tempfile :seekable/;
|
use File::Temp qw/ tempfile :seekable/;
|
||||||
use Net::FTP;
|
use Net::FTP;
|
||||||
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
|
use Archive::Tar;
|
||||||
use Time::localtime;
|
use Time::localtime;
|
||||||
|
|
||||||
my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path);
|
my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path);
|
||||||
@ -72,12 +72,10 @@ if (-e $geoIPfile) {
|
|||||||
unlink($geoIPfile);
|
unlink($geoIPfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
open(my $fh, ">", $geoIPfile)
|
my $next = Archive::Tar->iter('../GeoLite2-Country.tar.gz', 1, {filter => qr/\.mmdb$/});
|
||||||
or die "cannot open $geoIPfile for writing: $!";
|
while (my $file = $next->()) {
|
||||||
binmode($fh);
|
$file->extract($geoIPfile) or warn "Extraction failed";
|
||||||
gunzip '../GeoLite2-Country.tar.gz' => $fh
|
}
|
||||||
or die "gunzip failed: $GunzipError\n";
|
|
||||||
close($fh);
|
|
||||||
|
|
||||||
my (@packages,@mac_exclude);
|
my (@packages,@mac_exclude);
|
||||||
@packages = ('base', 'cstrike', 'dod', 'esf', 'ns', 'tfc', 'ts');
|
@packages = ('base', 'cstrike', 'dod', 'esf', 'ns', 'tfc', 'ts');
|
||||||
|
Loading…
Reference in New Issue
Block a user