1 # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
3 pkgname=('geoip-database' 'geoip-database-extra')
7 url="https://mailfud.org/geoip-legacy/"
9 makedepends=('util-linux')
10 checkdepends=('geoip')
11 _source_base=https://sources.archlinux.org/other/packages/$pkgname/$pkgver
12 source=(GeoIP-$pkgver.dat.gz::$_source_base/GeoIP.dat.gz
13 GeoIPv6-$pkgver.dat.gz::$_source_base/GeoIPv6.dat.gz
14 GeoIPCity-$pkgver.dat.gz::$_source_base/GeoIPCity.dat.gz
15 GeoIPCityv6-$pkgver.dat.gz::$_source_base/GeoIPCityv6.dat.gz
16 GeoIPASNum-$pkgver.dat.gz::$_source_base/GeoIPASNum.dat.gz
17 GeoIPASNumv6-$pkgver.dat.gz::$_source_base/GeoIPASNumv6.dat.gz)
18 sha256sums=('aca8437106a8d0b968e0fa8473815fa4c83e1a06b43489eb6135da908f3333a5'
19 '2f465e5477c88391adb2928c1e6f486f76693f3af98b7140a68dac812ce90c4e'
20 '85405741234242b925389879f4065d1d11b3f13b224a5ab68139a87d32f8727e'
21 'b551e15c0d56331cee0734cfb291098016c4847734bead5b8e283275d268a310'
22 '61a87bbf3a50f0493a2a22bd64d878bfda2f2dd576e2f28de839df1bc0f5a2a6'
23 'a3e8602efbcd689de36c628838d5dfad79c0c927801d4e0555e218cd658814c7')
27 rename -v -- "-$pkgver" '' *.dat
33 if [[ $(geoiplookup -f GeoIP.dat 8.8.8.8) != *'US, United States' ]]; then
34 echo >&2 'Unable to resolve IPv4 address to country.'
38 if [[ $(geoiplookup6 -f GeoIPv6.dat 2001:4860:4860::8888) != *'US, United States' ]]; then
39 echo >&2 'Unable to resolve IPv6 address to country.'
43 if [[ $(geoiplookup -f GeoIPCity.dat 8.8.8.8) != *'US, CA, California, Los Angeles'* ]]; then
44 echo >&2 'Unable to resolve IPv4 address to city.'
48 if [[ $(geoiplookup6 -f GeoIPCityv6.dat 2001:4860:4860::8888) != *'US, 00, N/A, N/A'* ]]; then
49 echo >&2 'Unable to resolve IPv6 address to city.'
53 if [[ $(geoiplookup -f GeoIPASNum.dat 8.8.8.8) != *'AS15169 GOOGLE' ]]; then
54 echo >&2 'Unable to resolve IPv4 address to ASN.'
58 if [[ $(geoiplookup6 -f GeoIPASNumv6.dat 2001:4860:4860::8888) != *'AS15169 GOOGLE' ]]; then
59 echo >&2 'Unable to resolve IPv6 address to ASN.'
64 package_geoip-database() {
65 pkgdesc="GeoIP legacy country database (based on GeoLite2 data created by MaxMind)"
69 install -d "$pkgdir/usr/share/GeoIP"
70 install -m644 -t "$pkgdir/usr/share/GeoIP" GeoIP{,v6}.dat
73 package_geoip-database-extra() {
74 pkgdesc="GeoIP legacy city/ASN databases (based on GeoLite2 data created by MaxMind)"
78 install -d "$pkgdir/usr/share/GeoIP"
79 install -m644 -t "$pkgdir/usr/share/GeoIP" GeoIPCity{,v6}.dat GeoIPASNum{,v6}.dat
82 # vim:set ts=2 sw=2 et: