File nginx-geolite-asn.spec of Package nginx-geolite-asn

#
# spec file for package nginx-geolite-asn
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define ngx_conf_dir %{_sysconfdir}/nginx
%define geo_ip_dir geoip
%define geo_ip_path GeoIPASNum.dat
%define geo_ip_versioned_path GeoIPASNum-%{version}.dat

Name:           nginx-geolite-asn
# GeoIP databases are not versioned, but they are updated monthly.
# That's why we use YY.MM format for versioning this package.
Version:        18.06
Release:        0
Summary:        IP ASN geolocation databases for nginx
License:        CC-BY-SA-4.0
Group:          Productivity/Networking/Web/Proxy
Url:            https://dev.maxmind.com/geoip/legacy/geolite/
# Archive name available on the upstream server doesn't contain any version in
# name, so we are adding it in order to be able to update it in OBS.
Source:         https://download.maxmind.com/download/geoip/database/asnum/%{geo_ip_path}.gz#/%{geo_ip_versioned_path}.gz
Source1:        LICENSE
Requires:       nginx
BuildArch:      noarch

%description
The GeoLite databases are IP geolocation databases.

IP geolocation is inherently imprecise. Locations are often near the center of
the population. Any location provided by a GeoIP database should not be used to
identify a particular address or household.

%prep
gunzip -k %{SOURCE0}
mv %{_sourcedir}/%{geo_ip_versioned_path} %{_sourcedir}/%{geo_ip_path}
cp %{SOURCE1} .

%build

%install
mkdir -p %{buildroot}%{nginx_conf_dir}/%{geo_ip_dir}
install -D -m 0644 %{_sourcedir}/%{geo_ip_path} %{buildroot}%{ngx_conf_dir}/%{geo_ip_dir}/%{geo_ip_path}

%files
%license LICENSE
%dir %{ngx_conf_dir}
%dir %{ngx_conf_dir}/%{geo_ip_dir}
%config %{ngx_conf_dir}/%{geo_ip_dir}/%{geo_ip_path}

%changelog
openSUSE Build Service is sponsored by