mirror of
https://github.com/mistydemeo/tigerbrew.git
synced 2026-11-26 19:09:48 -05:00
geoip: add geoipupdate option and fix data directory
Previous versions of geoip had geoipupdate bundled. It’s now a separate project, but most users who upgrade will be surprised it’s gone, and most new installs will want it. geoip and geoipupdate need to share a data directory, which is /usr/local/share/GeoIP by default. This doesn’t work with Homebrew, since it can’t link into both cellar locations. I’ve manually specified a reasonable location as the default. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
1 parent
ea0fe99d1e
commit
e7cda7f451
1 file changed
+18
-1
@@ -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 )"
|
||||
+
|
||||
|
||||
Reference in new issue
Block a user