diff options
| -rw-r--r-- | Library/Formula/geoip.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Library/Formula/geoip.rb b/Library/Formula/geoip.rb index 2e3ade95c..1aeb95215 100644 --- a/Library/Formula/geoip.rb +++ b/Library/Formula/geoip.rb @@ -9,6 +9,7 @@ class Geoip < Formula depends_on 'autoconf' => :build depends_on 'automake' => :build depends_on 'libtool' => :build + depends_on 'geoipupdate' => :optional option :universal @@ -30,11 +31,27 @@ class Geoip < Formula system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", + "--datadir=#{var}", "--prefix=#{prefix}" system "make", "check" system "make", "install" end + def post_install + geoip_data = Pathname.new "#{var}/GeoIP" + geoip_data.mkpath + + # Since default data directory moved, copy existing DBs + legacy_data = Pathname.new "#{HOMEBREW_PREFIX}/share/GeoIP" + cp Dir.glob("#{legacy_data}/*"), geoip_data if legacy_data.exist? + + ["City", "Country"].each do |type| + full = Pathname.new "#{geoip_data}/GeoIP#{type}.dat" + next if full.exist? or full.symlink? + ln_s "GeoLite#{type}.dat", full + end + end + test do system "curl", "-O", "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" system "gunzip", "GeoIP.dat.gz" @@ -49,7 +66,7 @@ index 30fc0f9..f20f095 100755 +++ b/bootstrap @@ -1,5 +1,14 @@ #!/bin/sh - + +# dl the dat file if needed +DIR="$( cd "$( dirname "$0" )" && pwd )" + |
