#!/bin/sh

# Update IPv6 free databases

# It would be much better if we could use geoipupdate for this as it only
# downloads the data if it has changed and checks it after download

DB_LOC=http://geolite.maxmind.com/download/geoip/database
ASDB_LOC=http://download.maxmind.com/download/geoip/database/asnum

cd /usr/share/GeoIP

# IPv6 Country database
wget --quiet $DB_LOC/GeoIPv6.dat.gz && mv -f GeoIPv6.dat GeoIPv6.dat.old && gunzip GeoIPv6.dat

# IPv6 City database
wget --quiet $DB_LOC/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz && mv -f GeoLiteCityv6.dat GeoLiteCityv6.dat.old && gunzip GeoLiteCityv6.dat

# IPv6 AS Number database
wget --quiet $ASDB_LOC/GeoIPASNumv6.dat.gz && mv -f GeoIPASNumv6.dat GeoIPASNumv6.dat.old && gunzip GeoIPASNumv6.dat
