diff --git a/community/geoipupdate/0001-remove-manuals.patch b/community/geoipupdate/0001-remove-manuals.patch new file mode 100644 index 000000000..7394bb02e --- /dev/null +++ b/community/geoipupdate/0001-remove-manuals.patch @@ -0,0 +1,27 @@ +From b1a37841d7f337458301064fef27d96c4d2ceefd Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Thu, 27 Feb 2020 18:26:42 -0700 +Subject: [PATCH] remove manuals + +--- + Makefile | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 99af8c4..76c5037 100644 +--- a/Makefile ++++ b/Makefile +@@ -33,9 +33,7 @@ all: \ + data: \ + $(BUILDDIR)/GeoIP.conf \ + $(BUILDDIR)/GeoIP.conf.md \ +- $(BUILDDIR)/geoipupdate.md \ +- $(BUILDDIR)/GeoIP.conf.5 \ +- $(BUILDDIR)/geoipupdate.1 ++ $(BUILDDIR)/geoipupdate.md + + $(BUILDDIR): + mkdir -p $(BUILDDIR) +-- +2.24.1 + diff --git a/community/geoipupdate/PKGBUILD b/community/geoipupdate/PKGBUILD new file mode 100644 index 000000000..29feaba89 --- /dev/null +++ b/community/geoipupdate/PKGBUILD @@ -0,0 +1,69 @@ +# Maintainer: Massimiliano Torromeo + +# ALARM: Kevin Mihelich +# - remove makedepend on pandoc +# - patch to remove manual generation that uses pandoc +# - comment manual installation + +pkgname=geoipupdate +pkgver=4.2.2 +pkgrel=1 +pkgdesc="Update GeoIP2 and GeoIP Legacy binary databases from MaxMind" +license=('Apache' 'MIT') +arch=('x86_64') +url="https://dev.maxmind.com/geoip/geoipupdate" +makedepends=(go-pie) +backup=(etc/GeoIP.conf) +provides=(geoip2-database) +replaces=(geoip2-database) + +source=( + "https://github.com/maxmind/geoipupdate/archive/v$pkgver/$pkgname-$pkgver.tar.gz" + "geoipupdate.service" + "geoipupdate.timer" + "0001-remove-manuals.patch" +) + +sha256sums=('a9267a1fbbadc4686198002d3de0ef60a65e3b47c4e050bcdccf692aa1791092' + '94d120a089524b91b2c3095332dee66b346bc97f1496cbff677ff02afa37a6cc' + 'ba9039ae9cc3dea4fe48480527b515cab2ad3a2f69aea5bf55f551e6895779e3' + 'bac4deced8219f56e1b394986f5125a6b36864bb5e9ebf0499ec0edcba55f9ed') + +prepare() { + cd "$srcdir/$pkgname-$pkgver" + sed -i 's/EditionIDs .*/EditionIDs GeoLite2-ASN GeoLite2-City GeoLite2-Country/' conf/GeoIP.conf.default + patch -p1 -i ../0001-remove-manuals.patch +} + +build() { + cd "$srcdir/$pkgname-$pkgver" + + export CONFFILE=/etc/GeoIP.conf + export DATADIR=/var/lib/GeoIP + + make BUILDDIR="$srcdir/build" data + + cd cmd/geoipupdate + export LDFLAGS="$LDFLAGS -X main.defaultConfigFile=$CONFFILE -X main.defaultDatabaseDirectory=$DATADIR -X main.version=$pkgver" + go build -trimpath -ldflags "-extldflags $LDFLAGS" -o "$srcdir/build/geoipupdate" . +} + +package() { + install -dm755 "$pkgdir/var/lib/GeoIP" + + cd "$srcdir" + install -Dm644 geoipupdate.service "$pkgdir/usr/lib/systemd/system/geoipupdate.service" + install -Dm644 geoipupdate.timer "$pkgdir/usr/lib/systemd/system/geoipupdate.timer" + + cd "$srcdir/build" + install -Dm755 geoipupdate "$pkgdir/usr/bin/geoipupdate" + install -Dm644 GeoIP.conf "$pkgdir/etc/GeoIP.conf" + install -Dm644 geoipupdate.md "$pkgdir/usr/share/doc/$pkgname/geoipupdate.md" + install -Dm644 GeoIP.conf.md "$pkgdir/usr/share/doc/$pkgname/GeoIP.conf.md" + #install -Dm644 geoipupdate.1 "$pkgdir/usr/share/man/man1/geoipupdate.1" + #install -Dm644 GeoIP.conf.5 "$pkgdir/usr/share/man/man5/GeoIP.conf.5" + + cd "$srcdir/$pkgname-$pkgver" + install -Dm644 LICENSE-APACHE "$pkgdir/usr/share/licenses/$pkgname/LICENSE-APACHE" + install -Dm644 LICENSE-MIT "$pkgdir/usr/share/licenses/$pkgname/LICENSE-MIT" +} diff --git a/community/geoipupdate/geoipupdate.service b/community/geoipupdate/geoipupdate.service new file mode 100644 index 000000000..e4810c9dd --- /dev/null +++ b/community/geoipupdate/geoipupdate.service @@ -0,0 +1,8 @@ +[Unit] +Description=Update GeoIP2 and GeoIP Legacy binary databases +Wants=network.target +After=network.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/geoipupdate --config-file /etc/GeoIP.conf diff --git a/community/geoipupdate/geoipupdate.timer b/community/geoipupdate/geoipupdate.timer new file mode 100644 index 000000000..0a37ac278 --- /dev/null +++ b/community/geoipupdate/geoipupdate.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Weekly update of GeoIP2 and GeoIP Legacy databases + +[Timer] +OnCalendar=weekly +AccuracySec=1h +Persistent=true + +[Install] +WantedBy=timers.target