aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoradamw <adamw@FreeBSD.org>2015-05-09 01:19:04 +0800
committeradamw <adamw@FreeBSD.org>2015-05-09 01:19:04 +0800
commite97a42ad59056466adebdb9298ab0a53617d2098 (patch)
tree46dad3ca57a7c185ef3c603971786b51750c05d5 /net
parent6891036ce49df465c3c5eb0b77788ae6ed1a2e05 (diff)
downloadfreebsd-ports-gnome-e97a42ad59056466adebdb9298ab0a53617d2098.tar.gz
freebsd-ports-gnome-e97a42ad59056466adebdb9298ab0a53617d2098.tar.zst
freebsd-ports-gnome-e97a42ad59056466adebdb9298ab0a53617d2098.zip
Support fetching the GeoLite City and GeoLite ASN databases.
Requested by: Scott Loga
Diffstat (limited to 'net')
-rw-r--r--net/GeoIP/Makefile2
-rw-r--r--net/GeoIP/files/geoipupdate.sh.in22
2 files changed, 20 insertions, 4 deletions
diff --git a/net/GeoIP/Makefile b/net/GeoIP/Makefile
index 88d0249ffa01..b1060b681874 100644
--- a/net/GeoIP/Makefile
+++ b/net/GeoIP/Makefile
@@ -4,7 +4,7 @@
PORTNAME= GeoIP
PORTVERSION= 1.6.5
DISTVERSIONPREFIX= v
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net geography
MAINTAINER= adamw@FreeBSD.org
diff --git a/net/GeoIP/files/geoipupdate.sh.in b/net/GeoIP/files/geoipupdate.sh.in
index 7fb8a43d4f86..1099a56c9d8f 100644
--- a/net/GeoIP/files/geoipupdate.sh.in
+++ b/net/GeoIP/files/geoipupdate.sh.in
@@ -1,5 +1,15 @@
#!/bin/sh
+# You can set the following environment variables:
+#
+# GEOIP_DB_SERVER: The default download server is geolite.maxmind.com
+# GEOIP_FETCH_CITY: If set (to anything), download the GeoLite City DB
+# GEOIP_FETCH_ASN: If sset, download the GeoIP ASN DB
+
+GEOIP_DB_SERVER=${GEOIP_DB_SERVER:=geolite.maxmind.com}
+GEOIP_FETCH_CITY=${GEOIP_FETCH_CITY:=}
+GEOIP_FETCH_ASN=${GEOIP_FETCH_ASN:=}
+
set -eu
echo Fetching GeoIP.dat and GeoIPv6.dat...
@@ -27,8 +37,14 @@ _fetch() {
return 0
}
-GEOIP_DB_SERVER=${GEOIP_DB_SERVER:=geolite.maxmind.com}
-
_fetch "http://${GEOIP_DB_SERVER}/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" GeoIP.dat
-
_fetch "http://${GEOIP_DB_SERVER}/download/geoip/database/GeoIPv6.dat.gz" GeoIPv6.dat
+
+if [ -n "$GEOIP_FETCH_CITY" ]; then
+ _fetch "http://${GEOIP_DB_SERVER}/download/geoip/database/GeoLiteCity.dat.gz" GeoLiteCity.dat
+ _fetch "http://${GEOIP_DB_SERVER}/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz" GeoLiteCityv6.dat
+fi
+if [ -n "$GEOIP_FETCH_ASN" ]; then
+ _fetch "http://${GEOIP_DB_SERVER}/download/geoip/database/asnum/GeoIPASNum.dat.gz" GeoIPASNum.dat
+ _fetch "http://${GEOIP_DB_SERVER}/download/geoip/database/asnum/GeoIPASNumv6.dat.gz" GeoIPASNumv6.dat
+fi