From mboxrd@z Thu Jan  1 00:00:00 1970
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH] GeoIP: Update to 1.25
Date: Wed, 11 Jan 2017 17:05:01 +0000
Message-ID: <1484154301.3113.1.camel@ipfire.org>
In-Reply-To: <cee6d332-3564-591f-cd7e-d88ff69b455c@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1102708894881555504=="
List-Id: <development.lists.ipfire.org>

--===============1102708894881555504==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi,

yes this looks alright. We should have only the one database any ways,
but generally we should change all paths.

The reason why I was asking for this is, that it is probably a very
good idea to keep in /usr and leave /usr/local for what it is intended
to: Programs compiled by the user of the system.

Would you like to send this as a patch that I can merge? Testing
shouldn't make any trouble.

Best,
-Michael

On Mon, 2017-01-09 at 19:06 +0100, Matthias Fischer wrote:
> On 09.01.2017 15:29, Michael Tremer wrote:
> > Hi,
>=20
> Hi,
>=20
> > is there any chance that we can move the database from /usr/local
> > to /usr
> > instead?
> > ...
>=20
> If I got it right, this would be one line in lfs and perhaps the
> following patch (geoip_1_25_change_database_path.patch)!?
>=20
> ***SNIP***
> --- lib/Geo/IP/PurePerl.pm	Tue Mar 30 15:41:34 2010
> +++ lib/Geo/IP/PurePerl.pm	Mon Jan 09 18:58:11 2017
> @@ -129,7 +129,7 @@
>=20
>=20
> =C2=A0# --- unfortunately we do not know the path so we assume the
> -# default path /usr/local/share/GeoIP
> +# default path /usr/share/GeoIP
> =C2=A0# if thats not true, you can set $Geo::IP::PurePerl::OPEN_TYPE_PATH
> =C2=A0#
> =C2=A0sub open_type {
> @@ -210,7 +210,7 @@
> =C2=A0=C2=A0=C2=A0# this will be less messy once deprecated new( $path, [$f=
lags] )
> =C2=A0=C2=A0=C2=A0# is no longer supported (that's what open() is for)
>=20
> -=C2=A0=C2=A0my $def_db_file =3D '/usr/local/share/GeoIP/GeoIP.dat';
> +=C2=A0=C2=A0my $def_db_file =3D '/usr/share/GeoIP/GeoIP.dat';
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ($^O eq 'NetWare') {
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$def_db_file =3D 'sys:/etc/GeoIP/GeoIP.dat';
> =C2=A0=C2=A0=C2=A0} elsif ($^O eq 'MSWin32') {
> @@ -758,7 +758,7 @@
> =C2=A0=3Ditem $gi =3D Geo::IP->new( [$flags] );
>=20
> =C2=A0Constructs a new Geo::IP object with the default database located
> inside your system's
> -I<datadir>, typically I</usr/local/share/GeoIP/GeoIP.dat>.
> +I<datadir>, typically I</usr/share/GeoIP/GeoIP.dat>.
>=20
> =C2=A0Flags can be set to either GEOIP_STANDARD, or for faster performance
> =C2=A0(at a cost of using more memory), GEOIP_MEMORY_CACHE.
> --- t/1_lookup.t	Tue Mar 30 15:13:37 2010
> +++ t/1_lookup.t	Mon Jan 09 18:58:13 2017
> @@ -2,7 +2,7 @@
> =C2=A0use vars qw($dat);
>=20
> =C2=A0BEGIN {
> -=C2=A0=C2=A0foreach my $file ("GeoIP.dat",'/usr/local/share/GeoIP/GeoIP.da=
t')
> {
> +=C2=A0=C2=A0foreach my $file ("GeoIP.dat",'/usr/share/GeoIP/GeoIP.dat') {
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (-f $file) {
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$dat =3D $file;
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0last;
> --- t/2_namelookup.t	Tue Mar 30 15:21:37 2010
> +++ t/2_namelookup.t	Mon Jan 09 18:58:21 2017
> @@ -2,7 +2,7 @@
> =C2=A0use vars qw($dat);
>=20
> =C2=A0BEGIN {
> -=C2=A0=C2=A0foreach my $file ("GeoIP.dat",'/usr/local/share/GeoIP/GeoIP.da=
t')
> {
> +=C2=A0=C2=A0foreach my $file ("GeoIP.dat",'/usr/share/GeoIP/GeoIP.dat') {
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (-f $file) {
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$dat =3D $file;
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0last;
> --- Changes	Tue Mar 30 15:26:38 2010
> +++ Changes	Mon Jan 09 18:57:37 2017
> @@ -35,7 +35,7 @@
> =C2=A0	Country, City and Org requests benefit from
> GEOIP_MEMORY_CACHE and
> GEOIP_MMAP_CACHE
> =C2=A0	Add GEOIP_MMAP_CACHE support ( Peter Shipley )
> =C2=A0	Now works with new format of GeoIP ISP
> -	Corrected path to /usr/local/share/GeoIP/GeoIP.dat in geoip-
> lookup
> program.
> +	Corrected path to /usr/share/GeoIP/GeoIP.dat in geoip-lookup=20
> program.
>=20
> =C2=A01.18=C2=A0=C2=A0January 8th 2007
> =C2=A0	Replaced CS/Serbia and Montenegro with RS/Serbia, removed
> ZR/Zaire,
> added ME/Montenegro
> --- geoip-lookup	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup	Mon Jan 09 18:57:44 2017
> @@ -15,7 +15,7 @@
>=20
> =C2=A0The I<geoip-lookup> program will return the country for the IP
> address or
> =C2=A0hostname given as the first command line argument.
> -It queries the GeoIP Country database in
> C</usr/local/share/GeoIP/GeoIP.dat>.
> +It queries the GeoIP Country database in
> C</usr/share/GeoIP/GeoIP.dat>.
>=20
> =C2=A0By default it prints the ISO 3166 country code.=C2=A0=C2=A0Use the C<=
-l>
> option
> =C2=A0to print the country name.
> --- geoip-lookup-city	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup-city	Mon Jan 09 18:57:48 2017
> @@ -6,7 +6,7 @@
>=20
> =C2=A0my $addr =3D shift;
>=20
> -my $gi =3D Geo::IP::PurePerl->new(
> "/usr/local/share/GeoIP/GeoIPCity.dat",
> +my $gi =3D Geo::IP::PurePerl->new( "/usr/share/GeoIP/GeoIPCity.dat",
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0GEOIP_STANDARD );
>=20
> =C2=A0if ($addr) {
> --- geoip-lookup-isp	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup-isp	Mon Jan 09 18:57:50 2017
> @@ -7,7 +7,7 @@
>=20
> =C2=A0my $addr =3D shift;
>=20
> -my $gi =3D
> Geo::IP::PurePerl-
> >new("/usr/local/share/GeoIP/GeoIPISP.dat",GEOIP_STANDARD);
> +my $gi =3D
> Geo::IP::PurePerl-
> >new("/usr/share/GeoIP/GeoIPISP.dat",GEOIP_STANDARD);
>=20
> =C2=A0my $isp =3D $gi->org_by_name($addr);
>=20
> --- geoip-lookup-netspeed	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup-netspeed	Mon Jan 09 18:57:53 2017
> @@ -6,7 +6,7 @@
>=20
> =C2=A0my $addr =3D $ARGV[0];
>=20
> -my $gi =3D
> Geo::IP::PurePerl-
> >new("/usr/local/share/GeoIP/GeoIPNetSpeed.dat",GEOIP_STANDARD);
> +my $gi =3D
> Geo::IP::PurePerl-
> >new("/usr/share/GeoIP/GeoIPNetSpeed.dat",GEOIP_STANDARD);
>=20
> =C2=A0my $netspeed =3D $gi->id_by_addr($addr);
>=20
> --- geoip-lookup-org	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup-org	Mon Jan 09 18:57:59 2017
> @@ -7,7 +7,7 @@
>=20
> =C2=A0my $addr =3D shift;
>=20
> -my $gi =3D
> Geo::IP::PurePerl-
> >new("/usr/local/share/GeoIP/GeoIPOrg.dat",GEOIP_STANDARD);
> +my $gi =3D
> Geo::IP::PurePerl-
> >new("/usr/share/GeoIP/GeoIPOrg.dat",GEOIP_STANDARD);
>=20
> =C2=A0my $org =3D $gi->org_by_name($addr);
>=20
> --- geoip-lookup-region	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup-region	Mon Jan 09 18:58:01 2017
> @@ -10,7 +10,7 @@
>=20
> =C2=A0my $addr =3D $ARGV[0];
>=20
> -my $gi =3D
> Geo::IP::PurePerl-
> >new("/usr/local/share/GeoIP/GeoIPRegion.dat",GEOIP_STANDARD);
> +my $gi =3D
> Geo::IP::PurePerl-
> >new("/usr/share/GeoIP/GeoIPRegion.dat",GEOIP_STANDARD);
>=20
> =C2=A0my ($country,$region) =3D $gi->region_by_name($addr);
>=20
> --- INSTALL	Tue Mar 30 15:13:36 2010
> +++ INSTALL	Mon Jan 09 18:58:05 2017
> @@ -3,7 +3,7 @@
> =C2=A0# fetch latest GeoIP database, updated monthly
> =C2=A0wget
> http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/Geo
> IP.dat.gz
> =C2=A0gunzip GeoIP.dat.gz
> -mv GeoIP.dat /usr/local/share/GeoIP/GeoIP.dat
> +mv GeoIP.dat /usr/share/GeoIP/GeoIP.dat
>=20
> =C2=A0perl Makefile.PL
> =C2=A0make
> ***SNAP***
>=20
> I think this is what you mean - would this be sufficient? I could
> give
> it a try...
>=20
> Best,
> Matthias
>=20

--===============1102708894881555504==
Content-Type: application/pgp-signature
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="signature.asc"
MIME-Version: 1.0

LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjIKCmlRSWNCQUFC
Q2dBR0JRSllkbVcrQUFvSkVJQjU4UDl2a0FrSHRVc1FBSVYzZnJFWVZ2c1NFNzMxWlpML0JrLzYK
dm9LOEJRN2R5bW94WFZmL0l6YUxYdXQ0eHVlU3FpY0loWlRkZjcyUnY4MTY4dTVzTnJnakd3akEw
VU1aQnVMTwpvVnRKVXh1UGtHdExXSkhXSlpaeEJBT3BodHprTWJ6Sjh2Y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