Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpolden/echoip.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2018-02-09 23:20:32 +0300
committerMartin Polden <mpolden@mpolden.no>2018-02-09 23:45:22 +0300
commita7ff603ab10b24599689aa1eab96522ea9659316 (patch)
tree581dfa4e4fbd55fc6ab8e46d7e1b0a38c33972af /Makefile
parentb3e0079aa40d943ffb7da6e5169319e4766a1b00 (diff)
Update database URLs
Fixes #46
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 14 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index b851e18..ef5bffc 100644
--- a/Makefile
+++ b/Makefile
@@ -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)