Date: Sat, 6 Sep 2014 23:03:42 +0000 (UTC) From: Adam Weinberger <adamw@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r367482 - in head/net/GeoIP: . files Message-ID: <201409062303.s86N3gcR082178@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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@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 }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409062303.s86N3gcR082178>