Date: Monday, June 12, 2017 @ 14:48:25
  Author: mtorromeo
Revision: 236535

Add geoip2-database

Added:
  geoip2-database/
  geoip2-database/trunk/
  geoip2-database/trunk/PKGBUILD
  geoip2-database/trunk/check-last-modified.sh

------------------------+
 PKGBUILD               |   39 +++++++++++++++++++++++++++++++++++++++
 check-last-modified.sh |   23 +++++++++++++++++++++++
 2 files changed, 62 insertions(+)

Added: geoip2-database/trunk/PKGBUILD
===================================================================
--- geoip2-database/trunk/PKGBUILD                              (rev 0)
+++ geoip2-database/trunk/PKGBUILD      2017-06-12 14:48:25 UTC (rev 236535)
@@ -0,0 +1,39 @@
+# $Id$
+# Maintainer: Massimiliano Torromeo <massimiliano.torro...@gmail.com>
+
+pkgname='geoip2-database'
+pkgver=20170611
+pkgrel=1
+pkgdesc="GeoLite2 IP geolocation databases compiled by MaxMind"
+arch=('any')
+url="https://dev.maxmind.com/geoip/geoip2/geolite2/";
+license=('custom:OPEN DATA LICENSE')
+source=(GeoLite2-City-$pkgver.tar.gz::http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
+        
GeoLite2-Country-$pkgver.tar.gz::http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz
+        
GeoLite2-ASN-$pkgver.tar.gz::http://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=('bc47ba58873a542046e974c7dbf5205f30ca207bf5dc5ed6b0223d70b93cb49e'
+            'd76206e55cdaff823dbd09e376bf8089ee0b4ee618dcbd634e9c1cb461499068'
+            'c8c2cd9c18902b6d27bf7a41c8008d82c6800861497beacd3c276ed661fe3939')
+
+prepare() {
+  cd "$srcdir"
+
+  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/usr/share/GeoIP"
+  install -m644 -t "$pkgdir/usr/share/GeoIP" GeoLite2-{City,Country,ASN}.mmdb
+
+  install -Dm644 COPYRIGHT.txt 
"$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT.txt"
+  install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE.txt"
+}

Added: geoip2-database/trunk/check-last-modified.sh
===================================================================
--- geoip2-database/trunk/check-last-modified.sh                                
(rev 0)
+++ geoip2-database/trunk/check-last-modified.sh        2017-06-12 14:48:25 UTC 
(rev 236535)
@@ -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

Reply via email to