From 3eb0485d0fdbd4e577e98772a62dbfc668f7ce19 Mon Sep 17 00:00:00 2001 From: "Andrew M. 'Leny' Lindley" Date: Tue, 24 Mar 2015 21:06:04 +0000 Subject: [PATCH 1/5] Add geoip-database-contrib from multiverse Both program (GPL-2) and downloaded databases (CC-BY-SA 3.0 Unported) are GNU FSDG compatible. Resolves User Issue 13927 --- helpers/make-geoip-database-contrib | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 helpers/make-geoip-database-contrib diff --git a/helpers/make-geoip-database-contrib b/helpers/make-geoip-database-contrib new file mode 100644 index 0000000..bffac2e --- /dev/null +++ b/helpers/make-geoip-database-contrib @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Copyright (C) 2015 Andrew M. Lindley +# +# 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 + +changelog 'Imported into Trisquel #13927' + +compile + From 6cd1de8eccb59df70235149165f6867ac8e4f07f Mon Sep 17 00:00:00 2001 From: "Andrew M. 'Leny' Lindley" Date: Wed, 8 Apr 2015 11:29:10 +0100 Subject: [PATCH 2/5] Download source CSVs for GNU FSDG compliance --- .../geoip-database-contrib/copyright.shim | 6 ++ .../geoip-database-contrib_update.shim | 56 +++++++++++++++++++ helpers/make-geoip-database-contrib | 4 ++ 3 files changed, 66 insertions(+) create mode 100644 helpers/DATA/geoip-database-contrib/copyright.shim create mode 100644 helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim diff --git a/helpers/DATA/geoip-database-contrib/copyright.shim b/helpers/DATA/geoip-database-contrib/copyright.shim new file mode 100644 index 0000000..e920649 --- /dev/null +++ b/helpers/DATA/geoip-database-contrib/copyright.shim @@ -0,0 +1,6 @@ + +Files: geoip-database-contrib_update +Copyright: 2010/2013, Ludovico Cavedon + Patrick Matthäi + 2015 Andrew Lindley +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 0000000..e9cd76e --- /dev/null +++ b/helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim @@ -0,0 +1,56 @@ +# 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/" + +FAILED=0 + +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 index bffac2e..835d5c6 100644 --- a/helpers/make-geoip-database-contrib +++ b/helpers/make-geoip-database-contrib @@ -22,6 +22,10 @@ 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 + changelog 'Imported into Trisquel #13927' compile From 78eeb6eccd151cdf93066123973eb1078b00f2d8 Mon Sep 17 00:00:00 2001 From: "Andrew M. 'Leny' Lindley" Date: Thu, 9 Apr 2015 07:15:01 +0100 Subject: [PATCH 3/5] Delete downloaded CSVs in postrm --- .../geoip-database-contrib_update.shim | 2 -- helpers/make-geoip-database-contrib | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim b/helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim index e9cd76e..f50a396 100644 --- a/helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim +++ b/helpers/DATA/geoip-database-contrib/geoip-database-contrib_update.shim @@ -20,8 +20,6 @@ GEOLITE_ASNUM_IPV6_CSV_FILE="GeoIPASNum2v6.zip" GEOIP_CSV_DIR="/usr/share/doc/geoip-database-contrib/csv/" -FAILED=0 - mkdir -p $GEOIP_CSV_DIR for url in \ diff --git a/helpers/make-geoip-database-contrib b/helpers/make-geoip-database-contrib index 835d5c6..adb619a 100644 --- a/helpers/make-geoip-database-contrib +++ b/helpers/make-geoip-database-contrib @@ -22,10 +22,14 @@ EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu $UPSTREAM multiverse' . ./config -sed "/exit 0/d" -i geoip-database-contrib_update +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 -rf /usr/share/doc/geoip-database-contrib/csv +' -i debian/postrm + changelog 'Imported into Trisquel #13927' compile From c33910918b5210f5afe12f932b0aceb7099fd644 Mon Sep 17 00:00:00 2001 From: "Andrew M. 'Leny' Lindley" Date: Thu, 9 Apr 2015 07:54:23 +0100 Subject: [PATCH 4/5] Remove downloaded CSVs in postrm no. 2 - to inferred packaging standards --- helpers/make-geoip-database-contrib | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helpers/make-geoip-database-contrib b/helpers/make-geoip-database-contrib index adb619a..d91771b 100644 --- a/helpers/make-geoip-database-contrib +++ b/helpers/make-geoip-database-contrib @@ -27,7 +27,12 @@ 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 -rf /usr/share/doc/geoip-database-contrib/csv + 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 'Imported into Trisquel #13927' From 74802ac93b81026c5bbbb6bab10f42f5741c364e Mon Sep 17 00:00:00 2001 From: "Andrew M. 'Leny' Lindley" Date: Thu, 16 Apr 2015 13:32:37 +0100 Subject: [PATCH 5/5] Correct changelog comment as per code review --- helpers/make-geoip-database-contrib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/make-geoip-database-contrib b/helpers/make-geoip-database-contrib index d91771b..95d5a8c 100644 --- a/helpers/make-geoip-database-contrib +++ b/helpers/make-geoip-database-contrib @@ -35,7 +35,7 @@ sed '/rm -f \/usr\/share\/GeoIP\/GeoLiteCityv6\.dat/a\ rm -f /usr/share/doc/geoip-database-contrib/csv/GeoIPASNum2v6.zip ' -i debian/postrm -changelog 'Imported into Trisquel #13927' +changelog 'Handle CSV source in geoip-database-contrib_update and postrm #13927' compile