Skip to content

Commit

Permalink
ip2location download script sometimes outputs html instead of zip. sigh.
Browse files Browse the repository at this point in the history
  • Loading branch information
Avishai Ish-Shalom committed Nov 26, 2011
1 parent 35ce087 commit daaf2ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions external/ip2location/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ depends_on() {
which $1 &>/dev/null || die "$1 is missing!"
}

verify_zip() {
[ -f "$1" ] || die "Can't find zip file $1"
unzip -l "$1" >/dev/null || die "zip file $1 is corrupted."
}

[ -n "$LOGIN" ] || usage
[ -n "$PASSWORD" ] || usage
[ -n "$USER" ] || usage
Expand All @@ -48,6 +53,7 @@ rm "$TMPDIR/*"
cd $(dirname $0)
./download.pl -package $PKG -login $LOGIN -password $PASSWORD -output $TMPDIR/$PKG-$MONTH.zip || \
die "Failed to download, quitting"
verify_zip $TMPDIR $TMPDIR/$PKG-$MONTH.zip
unzip -u -o -d $TMPDIR $TMPDIR/$PKG-$MONTH.zip 'IP*.CSV' || die "Failed to download, quitting"

PKG_FILE="$TMPDIR/IP*.CSV"
Expand Down

0 comments on commit daaf2ab

Please sign in to comment.