Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Paul Howarth
16e108c3dd Drop free legacy database support
Don't try to update the free legacy GeoIP databases as they are no longer
distributed by upstream.

Drop the cron6 sub-package as the files it tries to download are no longer
distributed by upstream.

The out-of-the-box configuration is now set up to download the free GeoIP2
databases as used by libmaxminddb.
2019-01-21 12:10:42 +00:00
3 changed files with 18 additions and 78 deletions

View file

@ -6,6 +6,9 @@ addFilter("no-documentation")
# Cron scripts can be edited by end users
addFilter("executable-marked-as-config-file /etc/cron.weekly/geoipupdate")
# geoipupdate-cron6 is obsolete (upstream stopped providing free IPv6 databases) and not replaced
addFilter("obsolete-not-provided geoipupdate-cron6")
# Technical term
addFilter("spelling-error Summary\(en_US\) Cron -> ")
addFilter("spelling-error %description -l en_US Cron -> ")

View file

@ -2,25 +2,22 @@
Name: geoipupdate
Version: 3.1.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Update GeoIP2 and GeoIP Legacy binary databases from MaxMind
License: GPLv2
URL: http://dev.maxmind.com/geoip/geoipupdate/
Source0: http://github.com/maxmind/geoipupdate/releases/download/v%{version}/geoipupdate-%{version}.tar.gz
Source1: geoipupdate.cron
Source2: geoipupdate6.cron
BuildRequires: coreutils
BuildRequires: crontabs
BuildRequires: gcc
BuildRequires: libcurl-devel
BuildRequires: make
BuildRequires: sed
BuildRequires: zlib-devel
# Perl modules used by IPv6 cron script
BuildRequires: perl-generators
BuildRequires: perl(File::Copy)
BuildRequires: perl(File::Spec)
BuildRequires: perl(LWP::Simple)
BuildRequires: perl(PerlIO::gzip)
BuildRequires: perl(strict)
# Legacy databases fetched by cron6 sub-package no longer available
Obsoletes: geoipupdate-cron6 < %{version}-%{release}
%description
The GeoIP Update program performs automatic updates of GeoIP2 and GeoIP
@ -35,19 +32,8 @@ Obsoletes: GeoIP-update < 1.6.0
Provides: GeoIP-update = 1.6.0
%description cron
Cron job for weekly updates to GeoIP Legacy database from MaxMind.
%package cron6
Summary: Cron job to do weekly updates of GeoIP IPv6 databases
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
Requires: crontabs
Requires: wget
Obsoletes: GeoIP-update6 < 1.6.0
Provides: GeoIP-update6 = 1.6.0
%description cron6
Cron job for weekly updates to GeoIP IPv6 Legacy database from MaxMind.
Cron job for weekly updates to GeoIP2 and GeoIP Legacy binary databases from
MaxMind.
%prep
%setup -q
@ -62,18 +48,7 @@ make install DESTDIR=%{buildroot}
# We'll package the documentation ourselves
rm -rf %{buildroot}%{_datadir}/doc/geoipupdate
# Fix up the config file to have geoipupdate fetch the free legacy databases by default
sed -i -e 's/^\(ProductIds\) .*$/\1 506 517 533/' \
%{buildroot}%{_sysconfdir}/GeoIP.conf
install -D -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate
install -D -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate6
# Make the download directory for the IPv6 data cron job and some ghost files
mkdir -p %{buildroot}%{_datadir}/GeoIP/download/
: > %{buildroot}%{_datadir}/GeoIP/download/GeoIPv6.dat.gz
: > %{buildroot}%{_datadir}/GeoIP/download/GeoLiteCityv6.dat.gz
: > %{buildroot}%{_datadir}/GeoIP/download/GeoIPASNumv6.dat.gz
%files
%if 0%{?_licensedir:1}
@ -84,21 +59,20 @@ mkdir -p %{buildroot}%{_datadir}/GeoIP/download/
%doc conf/GeoIP.conf.default README.md ChangeLog.md
%config(noreplace) %{_sysconfdir}/GeoIP.conf
%{_bindir}/geoipupdate
%dir %{_datadir}/GeoIP/
%{_mandir}/man1/geoipupdate.1*
%{_mandir}/man5/GeoIP.conf.5*
%files cron
%config(noreplace) %{_sysconfdir}/cron.weekly/geoipupdate
%files cron6
%config(noreplace) %{_sysconfdir}/cron.weekly/geoipupdate6
%dir %{_datadir}/GeoIP/
%dir %{_datadir}/GeoIP/download/
%ghost %{_datadir}/GeoIP/download/GeoIPv6.dat.gz
%ghost %{_datadir}/GeoIP/download/GeoLiteCityv6.dat.gz
%ghost %{_datadir}/GeoIP/download/GeoIPASNumv6.dat.gz
%changelog
* Mon Jan 21 2019 Paul Howarth <paul@city-fan.org> - 3.1.1-2
- Don't try to update the free legacy GeoIP databases as they are no longer
distributed by upstream
- Drop the cron6 sub-package as the files it tries to download are no longer
distributed by upstream
* Tue Sep 11 2018 Paul Howarth <paul@city-fan.org> - 3.1.1-1
- Update to 3.1.1
- Allow parsing of license keys longer than 12 characters

View file

@ -1,37 +0,0 @@
#!/usr/bin/perl
# This script is based on geolite-mirror-simple.pl from Maxmind's Geo::IP perl module
use strict;
our $VERSION = '0.01';
use LWP::Simple qw/ mirror RC_NOT_MODIFIED RC_OK $ua /;
use File::Copy qw/ mv /;
use File::Spec;
use PerlIO::gzip;
# Make sure the directories exist
-d ( my $download_dir = '/usr/share/GeoIP/download' ) or die $!;
-d ( my $dest_dir = '/usr/share/GeoIP' ) or die $!;
my %mirror = ( # local-filename geolite-name
'GeoIPv6.dat.gz' => 'http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz',
'GeoLiteCityv6.dat.gz' => 'http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz',
'GeoIPASNumv6.dat.gz' => 'http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz'
);
$ua->agent("geoipupdate6.cron/$VERSION");
chdir $download_dir or die $!;
for my $f ( keys %mirror ) {
my $rc = mirror( $mirror{$f}, $f );
next if $rc == RC_NOT_MODIFIED;
if ( $rc == RC_OK ) {
( my $outfile = $f ) =~ s/\.gz$//;
open my $in, '<:gzip', $f or die $!;
open my $out, '>', $outfile or die $!;
print $out $_ or die $! while <$in>;
mv( $outfile, File::Spec->catfile( $dest_dir, $outfile ) ) or die $!;
}
}
exit 0;