From f2abbceccd8e6f8b855f180b8352e07f3158ea44 Mon Sep 17 00:00:00 2001 From: Alexey Pavlov Date: Thu, 18 Jan 2018 14:14:23 +0300 Subject: [PATCH] goip2-databases: Update to 20180116 --- mingw-w64-geoip2-database/PKGBUILD | 31 +++++++++++++------ .../check-last-modified.sh | 23 ++++++++++++++ 2 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 mingw-w64-geoip2-database/check-last-modified.sh diff --git a/mingw-w64-geoip2-database/PKGBUILD b/mingw-w64-geoip2-database/PKGBUILD index 24b37f7dc7..30cf229f18 100644 --- a/mingw-w64-geoip2-database/PKGBUILD +++ b/mingw-w64-geoip2-database/PKGBUILD @@ -3,25 +3,38 @@ _realname=geoip2-database pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" -pkgver=20150720 +pkgver=20180116 pkgrel=1 pkgdesc="GeoLite country geolocation database compiled by MaxMind (mingw-w64)" arch=('any') -url="https://www.maxmind.com/en/geoip2-services-and-databases" +url="https://dev.maxmind.com/geoip/geoip2/geolite2/" license=('custom:Creative Commons Attribution-ShareAlike 3.0 Unported') -source=(GeoLite2-Country-${pkgver}.mmdb.gz::https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz - #GeoLite2-City-${pkgver}.mmdb.gz::https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz - ) -sha256sums=('4819459376f61423f5fb96eff141bf486d8e6133c47acd832d2ba87a39f2a922') +source=(GeoLite2-City-${pkgver}.tar.gz::https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz + GeoLite2-Country-${pkgver}.tar.gz::https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz + GeoLite2-ASN-${pkgver}.tar.gz::https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz) +noextract=(GeoLite2-City-${pkgver}.tar.gz + GeoLite2-Country-${pkgver}.tar.gz + GeoLite2-ASN-${pkgver}.tar.gz) +sha256sums=('025932f30ad6b5e77e1501cb953c87c77ca46eed5e22034e6cc3f206547db419' + '788ec447ffbb408f484fbf43454141553882c214bd5b8d39accb82bcc3be9f27' + 'f717a9f562ff84bc129be75bb4fecd6fb1f66f384fd7202eca8872e83efa2afa') prepare() { cd "${srcdir}" - mv GeoLite2-Country-${pkgver}.mmdb GeoLite2-Country.mmdb + + for _db in GeoLite2-{City,Country,ASN}; do + tar --strip-components=1 -xf ${_db}-${pkgver}.tar.gz --wildcards "*/${_db}.mmdb" + done + + tar --strip-components=1 -xf GeoLite2-ASN-${pkgver}.tar.gz --wildcards "*/COPYRIGHT.txt" "*/LICENSE.txt" } package() { cd "${srcdir}" - install -d "${pkgdir}${MINGW_PREFIX}/share/GeoIP2" - install -m644 -t "${pkgdir}${MINGW_PREFIX}/share/GeoIP2" GeoLite2-Country.mmdb + install -d "${pkgdir}${MINGW_PREFIX}/share/GeoIP" + install -m644 -t "${pkgdir}${MINGW_PREFIX}/share/GeoIP" GeoLite2-{City,Country,ASN}.mmdb + + install -Dm644 COPYRIGHT.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYRIGHT.txt" + install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.txt" } diff --git a/mingw-w64-geoip2-database/check-last-modified.sh b/mingw-w64-geoip2-database/check-last-modified.sh new file mode 100644 index 0000000000..378f3b529b --- /dev/null +++ b/mingw-w64-geoip2-database/check-last-modified.sh @@ -0,0 +1,23 @@ +#!/bin/bash -e + +# Unicode characters taken from pactree.c +UNICODE_IS_FUN="\u2514\u2500" + +verbose=0 +if [[ $1 == -v ]]; then + verbose=1 +fi + +URLS=(http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz + http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz + http://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz) + +for url in ${URLS[@]}; do + last_mod=$(curl -sI $url | grep -i ^Last-Modified: | cut -d' ' -f2- | tr -d '\r') + echo "$last_mod (${url##*/})" + + if ((verbose)); then + build_id=$(curl -s $url | gzip -cd | grep -aoE '[0-9]{8} Build [0-9]*') + echo -e "${UNICODE_IS_FUN}$build_id" + fi +done