svn commit: r367482 - in head/net/GeoIP: . files
Adam Weinberger
adamw at FreeBSD.org
Sat Sep 6 23:03:43 UTC 2014
Author: adamw
Date: Sat Sep 6 23:03:41 2014
New Revision: 367482
URL: http://svnweb.freebsd.org/changeset/ports/367482
QAT: https://qat.redports.org/buildarchive/r367482/
Log:
Rather than fetching the data files and piping them through gunzip,
download them completely and then gunzip them. This preserves the
modtimes, and is the only way of knowing the actual age of the
data files.
Suggested by: ache
Modified:
head/net/GeoIP/Makefile
head/net/GeoIP/files/geoipupdate.sh.in
Modified: head/net/GeoIP/Makefile
==============================================================================
--- head/net/GeoIP/Makefile Sat Sep 6 22:55:17 2014 (r367481)
+++ head/net/GeoIP/Makefile Sat Sep 6 23:03:41 2014 (r367482)
@@ -3,6 +3,7 @@
PORTNAME= GeoIP
PORTVERSION= 1.6.2
+PORTREVISION= 1
CATEGORIES= net geography
MAINTAINER= adamw at FreeBSD.org
Modified: head/net/GeoIP/files/geoipupdate.sh.in
==============================================================================
--- head/net/GeoIP/files/geoipupdate.sh.in Sat Sep 6 22:55:17 2014 (r367481)
+++ head/net/GeoIP/files/geoipupdate.sh.in Sat Sep 6 23:03:41 2014 (r367482)
@@ -9,19 +9,20 @@ echo Fetching GeoIP.dat and GeoIPv6.dat.
_fetch() {
url="$1"
out="$2"
- TEMPFILE="$(mktemp "%%DATADIR%%"/GeoIP.dat-XXXXXX)"
- trap 'rc=$? ; set +e ; rm -f "'"$TEMPFILE"'" ; exit $rc' 0
- if fetch -o - "$url" | gunzip >> "$TEMPFILE" ; then
- chmod 444 "$TEMPFILE"
- if ! mv -f "$TEMPFILE" "%%DATADIR%%"/"$2" ; then
- echo "Unable to replace %%DATADIR%%/$2"
- return 2
- fi
+ TEMPDIR="$(mktemp -d /tmp/GeoIPupdate.XXXXXX)"
+ trap 'rc=$? ; set +e ; rm -rf "'"$TEMPDIR"'" ; exit $rc' 0
+ if fetch -o "$TEMPDIR/$out.gz" "$url"; then
+ gunzip "$TEMPDIR/$out.gz"
+ chmod 444 "$TEMPDIR/$out"
+ if ! mv -f "$TEMPDIR/$out" "%%DATADIR%%"/"$2"; then
+ echo "Unable to replace %%DATADIR%%/$2"
+ return 2
+ fi
else
- echo "$2 download failed"
- return 1
+ echo "$2 download failed"
+ return 1
fi
- rm -f "$TEMPFILE"
+ rmdir "$TEMPDIR"
trap - 0
return 0
}
More information about the svn-ports-head
mailing list