diff --git a/helpers/DATA/geoip-database-contrib/copyright.shim b/helpers/DATA/geoip-database-contrib/copyright.shim new file mode 100644 index 0000000000000000000000000000000000000000..e9206493357f20fcfda88d954eb76516f7bc1c0b --- /dev/null +++ b/helpers/DATA/geoip-database-contrib/copyright.shim @@ -0,0 +1,6 @@ + +Files: geoip-database-contrib_update +Copyright: 2010/2013, Ludovico Cavedon <cavedon@debian.org> + Patrick Matthäi <pmatthaei@debian.org> + 2015 Andrew Lindley <andrew@andrewlindley.co.uk> +License: GPL-2+ diff --git a/helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim b/helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim new file mode 100644 index 0000000000000000000000000000000000000000..f50a3966ee6ff53e215cd488fcf8a663185df544 --- /dev/null +++ b/helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim @@ -0,0 +1,54 @@ +# Download the compressed source CSVs for GNU FSDG compliance + +GEOLITE_COUNTRY_CSV_PATH="" +GEOLITE_COUNTRY_CSV_FILE="GeoIPCountryCSV.zip" + +GEOLITE_COUNTRY_IPV6_CSV_PATH="" +GEOLITE_COUNTRY_IPV6_CSV_FILE="GeoIPv6.csv.gz" + +GEOLITE_CITY_CSV_PATH="GeoLiteCity_CSV/" +GEOLITE_CITY_CSV_FILE="GeoLiteCity-latest.tar.xz" + +GEOLITE_CITY_IPV6_CSV_PATH="GeoLiteCityv6-beta/" +GEOLITE_CITY_IPV6_CSV_FILE="GeoLiteCityv6.csv.gz" + +GEOLITE_ASNUM_CSV_PATH="asnum/" +GEOLITE_ASNUM_CSV_FILE="GeoIPASNum2.zip" + +GEOLITE_ASNUM_IPV6_CSV_PATH="asnum/" +GEOLITE_ASNUM_IPV6_CSV_FILE="GeoIPASNum2v6.zip" + +GEOIP_CSV_DIR="/usr/share/doc/geoip-database-contrib/csv/" + +mkdir -p $GEOIP_CSV_DIR + +for url in \ + "$GEOIP_URL$GEOLITE_COUNTRY_CSV_PATH$GEOLITE_COUNTRY_CSV_FILE" \ + "$GEOIP_URL$GEOLITE_COUNTRY_IPV6_CSV_PATH$GEOLITE_COUNTRY_IPV6_CSV_FILE" \ + "$GEOIP_URL$GEOLITE_CITY_CSV_PATH$GEOLITE_CITY_CSV_FILE" \ + "$GEOIP_URL$GEOLITE_CITY_IPV6_CSV_PATH$GEOLITE_CITY_IPV6_CSV_FILE" \ + "$GEOIP_URL$GEOLITE_ASNUM_CSV_PATH$GEOLITE_ASNUM_CSV_FILE" \ + "$GEOIP_URL$GEOLITE_ASNUM_IPV6_CSV_PATH$GEOLITE_ASNUM_IPV6_CSV_FILE" +do + echo "Downloading: $url" + + # Download file in the same directory as the final one so that the "mv" + # below can be atomic. + TEMP=$(mktemp --tmpdir=$GEOIP_CSV_DIR) + FILE=$(basename $url) + + /usr/bin/wget -q -t3 -T15 "$url" -O $TEMP + + if [ "$?" != "0" ] + then + echo "Failed to download $url" + else + rm -f $GEOIP_CSV_DIR$FILE + mv $TEMP $GEOIP_CSV_DIR$FILE + chmod 644 $GEOIP_CSV_DIR$FILE + fi + + rm -f $TEMP +done + +exit 0 diff --git a/helpers/make-geoip-database-contrib b/helpers/make-geoip-database-contrib new file mode 100644 index 0000000000000000000000000000000000000000..95d5a8cb749e7f4389ae8afe951d0c80fe4cd8c8 --- /dev/null +++ b/helpers/make-geoip-database-contrib @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Copyright (C) 2015 Andrew M. Lindley <andrew@andrewlindley.co.uk> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +VERSION=1 +EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu $UPSTREAM multiverse' + +. ./config + +sed "/^exit 0/d" -i geoip-database-contrib_update +cat $DATA/geoip-database-contrib_update.shim >> geoip-database-contrib_update +cat $DATA/copyright.shim >> debian/copyright + +sed '/rm -f \/usr\/share\/GeoIP\/GeoLiteCityv6\.dat/a\ + rm -f /usr/share/doc/geoip-database-contrib/csv/GeoIPCountryCSV.zip\ + rm -f /usr/share/doc/geoip-database-contrib/csv/GeoIPv6.csv.gz\ + rm -f /usr/share/doc/geoip-database-contrib/csv/GeoLiteCity-latest.tar.xz\ + rm -f /usr/share/doc/geoip-database-contrib/csv/GeoLiteCityv6.csv.gz\ + rm -f /usr/share/doc/geoip-database-contrib/csv/GeoIPASNum2.zip\ + rm -f /usr/share/doc/geoip-database-contrib/csv/GeoIPASNum2v6.zip +' -i debian/postrm + +changelog 'Handle CSV source in geoip-database-contrib_update and postrm #13927' + +compile +