4 # Copyright (C) 2011, 2012 by Raphael Geissert <geissert@debian.org>
6 # This file is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This file is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this file If not, see <http://www.gnu.org/licenses/>.
19 # On Debian systems, the complete text of the GNU General
20 # Public License 3 can be found in '/usr/share/common-licenses/GPL-3'.
26 if which unxz >/dev/null; then
32 for db in asnum/GeoIPASNum.dat.gz GeoLiteCity.dat.$compression asnum/GeoIPASNumv6.dat.gz GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz; do
33 wget -U '' -N http://geolite.maxmind.com/download/geoip/database/$db
34 db="$(basename "$db")"
40 echo "error: unknown compression of file $db" >&2
45 decomp_db="${db%.$file_comp}"
46 if [ -f $decomp_db ]; then
47 [ $db -nt $decomp_db ] || continue
59 echo "error: unknown decompressor for .$file_comp" >&2
63 mv new.$decomp_db $decomp_db
64 touch -r $db $decomp_db