FreeBSD Bugzilla – Attachment 145688 Details for
Bug 192597
[PATCH] net/GeoIP: geoipupdate.sh script non-functional
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to create %%DATADIR%% before attempting download; general overhaul.
GeoIP.diff (text/plain), 2.10 KB, created by
Matthias Andree
on 2014-08-11 20:06:32 UTC
(
hide
)
Description:
Patch to create %%DATADIR%% before attempting download; general overhaul.
Filename:
MIME Type:
Creator:
Matthias Andree
Created:
2014-08-11 20:06:32 UTC
Size:
2.10 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 364635) >+++ Makefile (working copy) >@@ -3,7 +3,7 @@ > > PORTNAME= GeoIP > PORTVERSION= 1.6.0 >-PORTREVISION= 1 >+PORTREVISION= 2 > CATEGORIES= net geography > MASTER_SITES= http://geolite.maxmind.com/download/geoip/api/c/ > >Index: files/geoipupdate.sh.in >=================================================================== >--- files/geoipupdate.sh.in (revision 364635) >+++ files/geoipupdate.sh.in (working copy) >@@ -1,31 +1,31 @@ > #!/bin/sh > >+set -eu > echo Fetching GeoIP.dat and GeoIPv6.dat... > >-TEMPFILE=`mktemp %%DATADIR%%/GeoIP.dat-XXXXXX` >-if fetch -o - http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz | gunzip >> $TEMPFILE ; then >- chmod 644 $TEMPFILE >- if ! mv $TEMPFILE %%DATADIR%%/GeoIP.dat ; then >- rm $TEMPFILE >- echo Unable to overwrite %%DATADIR%%/GeoIP.dat >- exit 2 >+# arguments: >+# $1 URL >+# $2 output file name >+_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 >+ else >+ echo "$2 download failed" >+ return 1 > fi >-else >- rm $TEMPFILE >- echo GeoIP.dat download failed >- exit 1 >-fi >+ rm -f "$TEMPFILE" >+ trap - 0 >+ return 0 >+} > >-TEMPFILE=`mktemp %%DATADIR%%/GeoIPv6.dat-XXXXXX` >-if fetch -o - http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz | gunzip >> $TEMPFILE ; then >- chmod 644 $TEMPFILE >- if ! mv $TEMPFILE %%DATADIR%%/GeoIPv6.dat ; then >- rm $TEMPFILE >- echo Unable to overwrite %%DATADIR%%/GeoIPv6.dat >- exit 2 >- fi >-else >- rm $TEMPFILE >- echo GeoIPv6.dat download failed >- exit 1 >-fi >+_fetch "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" GeoIP.dat >+ >+_fetch "http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz" GeoIPv6.dat
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 192597
: 145688