aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraptalca <aptalca@linuxserver.io>2020-05-12 21:21:38 +0000
committerTimo Teräs <timo.teras@iki.fi>2020-05-15 08:39:33 +0300
commit16e467bff9514dd3091cffaff3ad91303a23f961 (patch)
treeea3ad203e118ec3c12c1cd6186781c203b93ee9f
parentaf8f3134752f45e1fa0b6ca779fa76a9e0efc97b (diff)
downloadaports-16e467bff9514dd3091cffaff3ad91303a23f961.tar.gz
aports-16e467bff9514dd3091cffaff3ad91303a23f961.tar.bz2
aports-16e467bff9514dd3091cffaff3ad91303a23f961.tar.xz
main/libmaxminddb: fix database retrieval
- Allow MaxMind license key input required for downloads - Update db retrieval (new endpoint with license key and new compressed file structure) MaxMind stopped allowing direct downloads of free databases without a license key: https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/ This commit allows user input of license key, which can be retrieved for free by registering on their website: https://www.maxmind.com/en/geolite2/signup
-rw-r--r--main/libmaxminddb/APKBUILD6
-rwxr-xr-xmain/libmaxminddb/libmaxminddb.confd5
-rwxr-xr-xmain/libmaxminddb/libmaxminddb.cron12
3 files changed, 14 insertions, 9 deletions
diff --git a/main/libmaxminddb/APKBUILD b/main/libmaxminddb/APKBUILD
index 72bd39fdab..79d733681d 100644
--- a/main/libmaxminddb/APKBUILD
+++ b/main/libmaxminddb/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=libmaxminddb
pkgver=1.4.2
-pkgrel=0
+pkgrel=1
pkgdesc="Maxmind GeoIP2 database library"
url="https://github.com/maxmind/libmaxminddb"
arch="all"
@@ -40,5 +40,5 @@ package() {
}
sha512sums="bc18d2f19a74639888a466483afde1bccfc3a83787011a6f38808b76e5a513c9912ff369ccbf584091d4def657e0574b16b35dc69ab12ae4c439aaaf3669c4c1 libmaxminddb-1.4.2.tar.gz
-1feb1f2dd57991d729b6f9d29834f43d7405038cdbdfb0113a0e8f8f951a74c5e40651f9d241460f110acdd300196cf580b370e6cec56985cca797ba5610e622 libmaxminddb.cron
-5f8dc6dad84cb1d188504a22470acf89542755c0bb3a78e4d3ae4e5bfa49fe64a7d2ee17441084db2710115463d39361df060a74b3a48fc4d8fc5e802afd2099 libmaxminddb.confd"
+f6d3dbee35da062a701d57dda96739dc7ccf753f30ce8a6c3b4dc281054a3a6e82cda4f515bf32652daabf85267bb3979ea0f18e6cbef270e41b2d0c72d50e1c libmaxminddb.cron
+03bdfd6d1d508ea5261a396ac9539f363dcb477b9cf11fd4c9b01001e03205fa667cde21295dc0cc3d38db50adebb9c57e147a22fc7945de7c72d75d10637128 libmaxminddb.confd"
diff --git a/main/libmaxminddb/libmaxminddb.confd b/main/libmaxminddb/libmaxminddb.confd
index 6955e542f1..80609eefa4 100755
--- a/main/libmaxminddb/libmaxminddb.confd
+++ b/main/libmaxminddb/libmaxminddb.confd
@@ -2,7 +2,10 @@
# MAXMINDDB_FILES="GeoLite2-City.mmdb"
# Database download directory
-# MAXMINDDB_URL="http://geolite.maxmind.com/download/geoip/database"
+# MAXMINDDB_URL="https://download.maxmind.com/app/geoip_download"
# Local target directory
# MAXMINDDB_LIBDIR="/var/lib/libmaxminddb"
+
+# MaxMind license key, can be retrieved through https://www.maxmind.com/en/geolite2/signup
+MAXMINDDB_LICENSE_KEY=""
diff --git a/main/libmaxminddb/libmaxminddb.cron b/main/libmaxminddb/libmaxminddb.cron
index 9b6e5fab8e..0e8f574890 100755
--- a/main/libmaxminddb/libmaxminddb.cron
+++ b/main/libmaxminddb/libmaxminddb.cron
@@ -4,9 +4,10 @@
set -e
-[ -z "$MAXMINDDB_FILES" ] && MAXMINDDB_FILES="GeoLite2-City.mmdb"
-[ -z "$MAXMINDDB_URL" ] && MAXMINDDB_URL="http://geolite.maxmind.com/download/geoip/database"
-[ -z "$MAXMINDDB_LIBDIR" ] && MAXMINDDB_LIBDIR="/var/lib/libmaxminddb"
+[ -z "$MAXMINDDB_FILES" ] && MAXMINDDB_FILES="GeoLite2-City.mmdb"
+[ -z "$MAXMINDDB_URL" ] && MAXMINDDB_URL="https://download.maxmind.com/app/geoip_download"
+[ -z "$MAXMINDDB_LIBDIR" ] && MAXMINDDB_LIBDIR="/var/lib/libmaxminddb"
+[ -z "$MAXMINDDB_LICENSE_KEY" ] && { echo "No MaxMind license key found; exiting. Please enter your license key into /etc/conf.d/libmaxminddb"; exit 1; }
clean_up() {
[ -n "$TMPDIR" ] && rm -rf "$TMPDIR"
@@ -15,8 +16,9 @@ trap clean_up EXIT SIGTERM SIGINT SIGQUIT
TMPDIR="$(mktemp -d)"
for filename in $MAXMINDDB_FILES; do
- curl --silent "$MAXMINDDB_URL/$filename.gz" -o "$TMPDIR/$filename.gz"
- gunzip "$TMPDIR/$filename.gz"
+ EDITION_ID=$(echo "${filename}" | sed 's/\.mmdb$//')
+ curl --silent "${MAXMINDDB_URL}?edition_id=${EDITION_ID}&license_key=${MAXMINDDB_LICENSE_KEY}&suffix=tar.gz" -o "$TMPDIR/${filename}.tar.gz"
+ tar xf "$TMPDIR/${filename}.tar.gz" -C "$TMPDIR" --strip-components=1
mv "$TMPDIR/$filename" "$MAXMINDDB_LIBDIR"
done
exit 0