author: kx <kx@radix.pro> 2023-04-09 23:18:24 +0300
committer: kx <kx@radix.pro> 2023-04-09 23:18:24 +0300
commit: 8b7e76c7ad2445c0920e9d056728f7b6baaa0c43
parent: 3dd1914515dc5c714451bc4148f0abb51672ed06
Commit Summary:
Diffstat:
1 file changed, 40 insertions, 0 deletions
diff --git a/packages/n/maxmind/geoip-db/Makefile b/packages/n/maxmind/geoip-db/Makefile
new file mode 100644
index 0000000..2012218
--- /dev/null
+++ b/packages/n/maxmind/geoip-db/Makefile
@@ -0,0 +1,52 @@
+#
+# Project Home:
+# ============
+# https://mailfud.org/geoip-legacy/
+#
+
+url = https://mailfud.org/geoip-legacy
+
+date = $(shell date +'%Y%m%d')
+suffix = tar.xz
+pkg_name = geoip-db-$(date)
+package = $(addsuffix .$(suffix), $(pkg_name))
+sha1s = $(addsuffix .sha1sum, $(package))
+
+files = GeoIP GeoIPv6 GeoIPCity GeoIPCityv6 GeoIPASNum GeoIPASNumv6 GeoIPISP GeoIPOrg
+tarballs = $(addprefix $(pkg_name)/, $(addsuffix .dat.gz, $(files)))
+
+script = $(pkg_name)/geoip_update.sh
+
+TARGETS = $(package) $(sha1s)
+
+all: $(TARGETS)
+
+.PHONY: downloads_clean
+
+$(tarballs):
+ @echo -e "\n======= Downloading source tarballs =======\n"
+ @mkdir -p $(pkg_name)
+ @( cd $(pkg_name) ; \
+ for tarball in $(tarballs) ; do \
+ wget -N $(url)/`basename $$tarball` ; \
+ done ; \
+ )
+
+$(script):
+ @( cd $(pkg_name) ; \
+ wget -N $(url)/`basename $(script)` ; \
+ )
+
+$(package): $(tarballs) $(script)
+ @echo -e "\n======= Create $(package) tarball =======\n"
+ @tar -cJvf $(package) $(pkg_name)/
+ @rm -rf $(pkg_name)/
+
+$(sha1s): %.$(suffix).sha1sum : %.$(suffix)
+ @for tarball in $< ; do \
+ echo -e "\n======= Calculation the '$$tarball' sha1sum =======\n" ; \
+ sha1sum --binary $$tarball > $$tarball.sha1sum ; \
+ done
+
+downloads_clean:
+ @rm -rf $(package) $(sha1s)