mbox

GeoIP: Update to 1.25

Message ID cee6d332-3564-591f-cd7e-d88ff69b455c@ipfire.org
State Superseded
Headers

Message

Matthias Fischer Jan. 10, 2017, 5:06 a.m. UTC
  On 09.01.2017 15:29, Michael Tremer wrote:
> Hi,

Hi,

> is there any chance that we can move the database from /usr/local to /usr
> instead?
> ...

If I got it right, this would be one line in lfs and perhaps the
following patch (geoip_1_25_change_database_path.patch)!?

***SNIP***
 make
***SNAP***

I think this is what you mean - would this be sufficient? I could give
it a try...

Best,
Matthias
  

Comments

Michael Tremer Jan. 12, 2017, 4:05 a.m. UTC | #1
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,
> 
> Hi,
> 
> > is there any chance that we can move the database from /usr/local
> > to /usr
> > instead?
> > ...
> 
> If I got it right, this would be one line in lfs and perhaps the
> following patch (geoip_1_25_change_database_path.patch)!?
> 
> ***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 @@
> 
> 
>  # --- unfortunately we do not know the path so we assume the
> -# default path /usr/local/share/GeoIP
> +# default path /usr/share/GeoIP
>  # if thats not true, you can set $Geo::IP::PurePerl::OPEN_TYPE_PATH
>  #
>  sub open_type {
> @@ -210,7 +210,7 @@
>    # this will be less messy once deprecated new( $path, [$flags] )
>    # is no longer supported (that's what open() is for)
> 
> -  my $def_db_file = '/usr/local/share/GeoIP/GeoIP.dat';
> +  my $def_db_file = '/usr/share/GeoIP/GeoIP.dat';
>      if ($^O eq 'NetWare') {
>      $def_db_file = 'sys:/etc/GeoIP/GeoIP.dat';
>    } elsif ($^O eq 'MSWin32') {
> @@ -758,7 +758,7 @@
>  =item $gi = Geo::IP->new( [$flags] );
> 
>  Constructs 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>.
> 
>  Flags can be set to either GEOIP_STANDARD, or for faster performance
>  (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 @@
>  use vars qw($dat);
> 
>  BEGIN {
> -  foreach my $file ("GeoIP.dat",'/usr/local/share/GeoIP/GeoIP.dat')
> {
> +  foreach my $file ("GeoIP.dat",'/usr/share/GeoIP/GeoIP.dat') {
>      if (-f $file) {
>        $dat = $file;
>        last;
> --- 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 @@
>  use vars qw($dat);
> 
>  BEGIN {
> -  foreach my $file ("GeoIP.dat",'/usr/local/share/GeoIP/GeoIP.dat')
> {
> +  foreach my $file ("GeoIP.dat",'/usr/share/GeoIP/GeoIP.dat') {
>      if (-f $file) {
>        $dat = $file;
>        last;
> --- Changes	Tue Mar 30 15:26:38 2010
> +++ Changes	Mon Jan 09 18:57:37 2017
> @@ -35,7 +35,7 @@
>  	Country, City and Org requests benefit from
> GEOIP_MEMORY_CACHE and
> GEOIP_MMAP_CACHE
>  	Add GEOIP_MMAP_CACHE support ( Peter Shipley )
>  	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 
> program.
> 
>  1.18  January 8th 2007
>  	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 @@
> 
>  The I<geoip-lookup> program will return the country for the IP
> address or
>  hostname 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>.
> 
>  By default it prints the ISO 3166 country code.  Use the C<-l>
> option
>  to 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 @@
> 
>  my $addr = shift;
> 
> -my $gi = Geo::IP::PurePerl->new(
> "/usr/local/share/GeoIP/GeoIPCity.dat",
> +my $gi = Geo::IP::PurePerl->new( "/usr/share/GeoIP/GeoIPCity.dat",
>                                   GEOIP_STANDARD );
> 
>  if ($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 @@
> 
>  my $addr = shift;
> 
> -my $gi =
> Geo::IP::PurePerl-
> >new("/usr/local/share/GeoIP/GeoIPISP.dat",GEOIP_STANDARD);
> +my $gi =
> Geo::IP::PurePerl-
> >new("/usr/share/GeoIP/GeoIPISP.dat",GEOIP_STANDARD);
> 
>  my $isp = $gi->org_by_name($addr);
> 
> --- geoip-lookup-netspeed	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup-netspeed	Mon Jan 09 18:57:53 2017
> @@ -6,7 +6,7 @@
> 
>  my $addr = $ARGV[0];
> 
> -my $gi =
> Geo::IP::PurePerl-
> >new("/usr/local/share/GeoIP/GeoIPNetSpeed.dat",GEOIP_STANDARD);
> +my $gi =
> Geo::IP::PurePerl-
> >new("/usr/share/GeoIP/GeoIPNetSpeed.dat",GEOIP_STANDARD);
> 
>  my $netspeed = $gi->id_by_addr($addr);
> 
> --- geoip-lookup-org	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup-org	Mon Jan 09 18:57:59 2017
> @@ -7,7 +7,7 @@
> 
>  my $addr = shift;
> 
> -my $gi =
> Geo::IP::PurePerl-
> >new("/usr/local/share/GeoIP/GeoIPOrg.dat",GEOIP_STANDARD);
> +my $gi =
> Geo::IP::PurePerl-
> >new("/usr/share/GeoIP/GeoIPOrg.dat",GEOIP_STANDARD);
> 
>  my $org = $gi->org_by_name($addr);
> 
> --- geoip-lookup-region	Tue Mar 30 15:13:36 2010
> +++ geoip-lookup-region	Mon Jan 09 18:58:01 2017
> @@ -10,7 +10,7 @@
> 
>  my $addr = $ARGV[0];
> 
> -my $gi =
> Geo::IP::PurePerl-
> >new("/usr/local/share/GeoIP/GeoIPRegion.dat",GEOIP_STANDARD);
> +my $gi =
> Geo::IP::PurePerl-
> >new("/usr/share/GeoIP/GeoIPRegion.dat",GEOIP_STANDARD);
> 
>  my ($country,$region) = $gi->region_by_name($addr);
> 
> --- INSTALL	Tue Mar 30 15:13:36 2010
> +++ INSTALL	Mon Jan 09 18:58:05 2017
> @@ -3,7 +3,7 @@
>  # fetch latest GeoIP database, updated monthly
>  wget
> http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/Geo
> IP.dat.gz
>  gunzip GeoIP.dat.gz
> -mv GeoIP.dat /usr/local/share/GeoIP/GeoIP.dat
> +mv GeoIP.dat /usr/share/GeoIP/GeoIP.dat
> 
>  perl Makefile.PL
>  make
> ***SNAP***
> 
> I think this is what you mean - would this be sufficient? I could
> give
> it a try...
> 
> Best,
> Matthias
>