diff options
author | Adam Weinberger <adamw@FreeBSD.org> | 2014-09-06 23:03:41 +0000 |
---|---|---|
committer | Adam Weinberger <adamw@FreeBSD.org> | 2014-09-06 23:03:41 +0000 |
commit | 6ade92e79b4cc5029f127cf722d98a26ac3660a2 (patch) | |
tree | d00e86fb974f4f6690443f7d5f36a0327f7424e6 /net/GeoIP | |
parent | 6cae5241fea0b3f8023e5fd1827ed47f29c759f0 (diff) | |
download | ports-6ade92e79b4cc5029f127cf722d98a26ac3660a2.tar.gz ports-6ade92e79b4cc5029f127cf722d98a26ac3660a2.zip |
Notes
Diffstat (limited to 'net/GeoIP')
-rw-r--r-- | net/GeoIP/Makefile | 1 | ||||
-rw-r--r-- | net/GeoIP/files/geoipupdate.sh.in | 23 |
2 files changed, 13 insertions, 11 deletions
diff --git a/net/GeoIP/Makefile b/net/GeoIP/Makefile index 3fbfbf240d8a..bdbc5f069025 100644 --- a/net/GeoIP/Makefile +++ b/net/GeoIP/Makefile @@ -3,6 +3,7 @@ PORTNAME= GeoIP PORTVERSION= 1.6.2 +PORTREVISION= 1 CATEGORIES= net geography MAINTAINER= adamw@FreeBSD.org diff --git a/net/GeoIP/files/geoipupdate.sh.in b/net/GeoIP/files/geoipupdate.sh.in index b80f292527cc..7d578188d547 100644 --- a/net/GeoIP/files/geoipupdate.sh.in +++ b/net/GeoIP/files/geoipupdate.sh.in @@ -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 } |