diff options
author | Martin Polden <mpolden@mpolden.no> | 2018-02-09 23:20:32 +0300 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2018-02-09 23:45:22 +0300 |
commit | a7ff603ab10b24599689aa1eab96522ea9659316 (patch) | |
tree | 581dfa4e4fbd55fc6ab8e46d7e1b0a38c33972af /Makefile | |
parent | b3e0079aa40d943ffb7da6e5169319e4766a1b00 (diff) |
Update database URLs
Fixes #46
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -1,3 +1,8 @@ +OS := $(shell uname) +ifeq ($(OS),Linux) + TAR_OPTS := --wildcards +endif + all: deps test vet install fmt: @@ -15,6 +20,12 @@ deps: install: go install -get-geoip-dbs: - curl -s http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz | gunzip > GeoLite2-Country.mmdb - curl -s http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz | gunzip > GeoLite2-City.mmdb +databases := GeoLite2-City GeoLite2-Country + +$(databases): + mkdir -p data + curl -fsSL -m 30 http://geolite.maxmind.com/download/geoip/database/$@.tar.gz | tar $(TAR_OPTS) --strip-components=1 -C $(PWD)/data -xzf - '*.mmdb' + test ! -f data/GeoLite2-City.mmdb || mv data/GeoLite2-City.mmdb data/city.mmdb + test ! -f data/GeoLite2-Country.mmdb || mv data/GeoLite2-Country.mmdb data/country.mmdb + +geoip-download: $(databases) |