# Generated by go2rpm 1.18.0 %bcond check 1 # https://github.com/maxmind/geoipupdate %global goipath github.com/maxmind/geoipupdate/v7 Version: 7.1.1 %gometa -L -f Name: geoipupdate Release: %autorelease Summary: Update GeoIP2 binary databases from MaxMind # Generated by go-vendor-tools License: Apache-2.0 AND BSD-3-Clause AND ISC AND MIT URL: %{gourl} Source0: %{gosource} # Generated by go-vendor-tools Source1: %{archivename}-vendor.tar.bz2 Source2: go-vendor-tools.toml Source3: geoipupdate.cron BuildRequires: coreutils BuildRequires: crontabs BuildRequires: go-vendor-tools BuildRequires: make BuildRequires: pandoc BuildRequires: perl-interpreter BuildRequires: perl(File::Temp) BuildRequires: perl(strict) BuildRequires: perl(warnings) BuildRequires: sed # Legacy databases fetched by cron6 sub-package no longer available Obsoletes: geoipupdate-cron6 < %{version}-%{release} %description The GeoIP Update program performs automatic updates of GeoIP2 binary databases. %package cron Summary: Cron job to do weekly updates of GeoIP databases BuildArch: noarch Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: crontabs Obsoletes: GeoIP-update < 1.6.0 Provides: GeoIP-update = 1.6.0 %description cron Cron job for weekly updates to GeoIP2 binary databases from MaxMind. %prep %goprep -A %setup -q -T -D -a1 %{forgesetupargs} %autopatch -p1 %generate_buildrequires %go_vendor_license_buildrequires -c %{S:2} %build %global gomodulesmode GO111MODULE=on export LDFLAGS='-X main.defaultConfigFile=%{_sysconfdir}/GeoIP.conf -X main.defaultDatabaseDirectory=%{_datadir}/GeoIP ' %gobuild -o %{gobuilddir}/bin/geoipupdate %{goipath}/cmd/geoipupdate # Work around hardcoded "build" path in dev-bin/make-man-pages.pl ln -s %{gobuilddir} build # Prepare the config files and documentation make BUILDDIR=%{gobuilddir} CONFFILE=%{_sysconfdir}/GeoIP.conf DATADIR=%{_datadir}/GeoIP data %install %go_vendor_license_install -c %{S:2} install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ # Install the configuration file # By default we just use the free GeoIP2 databases install -m 0755 -vd %{buildroot}%{_sysconfdir} install -m 0644 -vp conf/GeoIP.conf.default %{buildroot}%{_sysconfdir}/GeoIP.conf # Ensure the GeoIP data directory exists # Note: not using %%ghost files for default databases to avoid issues when co-existing with the geolite2 package install -m 0755 -vd %{buildroot}%{_datadir}/GeoIP # Install the cron script for fetching weekly updates install -m 0755 -vd %{buildroot}%{_sysconfdir}/cron.weekly install -m 0755 -vp %{S:3} %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate # Install the manpages install -m 0755 -vd %{buildroot}%{_mandir}/man1 install -m 0644 -vp _build/geoipupdate.1 %{buildroot}%{_mandir}/man1/geoipupdate.1 install -m 0755 -vd %{buildroot}%{_mandir}/man5 install -m 0644 -vp _build/GeoIP.conf.5 %{buildroot}%{_mandir}/man5/GeoIP.conf.5 %check %go_vendor_license_check -c %{S:2} %if %{with check} %gotest ./... %endif %files -f %{go_vendor_license_filelist} %license vendor/modules.txt %doc doc CHANGELOG.md README.dev.md README.md %{_bindir}/geoipupdate %config(noreplace) %{_sysconfdir}/GeoIP.conf %dir %{_datadir}/GeoIP/ %{_mandir}/man1/geoipupdate.1* %{_mandir}/man5/GeoIP.conf.5* %files cron %config(noreplace) %{_sysconfdir}/cron.weekly/geoipupdate %changelog %autochangelog