]> git.pld-linux.org Git - packages/xtables-geoip.git/blame - xtables-geoip.spec
updated to 20170502
[packages/xtables-geoip.git] / xtables-geoip.spec
CommitLineData
a9e058f3 1Summary: GeoIP database files for xt_geoip
b7f9561d 2Summary(pl.UTF-8): Pliki baz danych GeoIP dla xt_geoip
a9e058f3 3Name: xtables-geoip
0f0a4c1a 4Version: 20170502
c1500f15 5Release: 1
2ce9a429 6License: GPL, Open Data License
a9e058f3 7Group: Networking/Admin
14600c7f 8Source0: http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
0f0a4c1a 9# Source0-md5: df40c4ccbfd0253787bca195fb95649c
a24c8ed7 10Source1: http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz
0f0a4c1a 11# Source1-md5: c1e4881c6ea770d4c5387686bd68887e
a24c8ed7
JR
12Source2: http://geolite.maxmind.com/download/geoip/database/LICENSE.txt
13# Source2-md5: a1381bd1aa0a0c91dc31b3f1e847cf4a
4ae41e77 14Source3: http://sourceforge.net/p/xtables-addons/xtables-addons/ci/master/tree/geoip/xt_geoip_build?format=raw&/xt_geoip_build
42c17d52 15# Source3-md5: 4dcd62c8b2c8b90cc88e961613118be3
b7f9561d 16URL: http://www.maxmind.com/
e77737fd 17BuildRequires: perl-Text-CSV_XS >= 0.69
2ce9a429 18BuildRequires: perl-base
2ec6929c 19BuildRequires: rpm >= 4.4.9-56
3be77cb9 20BuildRequires: unzip
a9e058f3 21BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
22
1f56ba0c
ER
23%define dbdir /usr/share/xt_geoip
24
14600c7f
ER
25# no debuginfo to package
26%define _enable_debug_packages 0
27
b7f9561d 28%ifarch ppc ppc64 s390 s390x sparc sparc64 sparcv9
377423bf
ER
29%define byteorder BE
30%else
31%define byteorder LE
32%endif
33
a9e058f3 34%description
35The package contains the GeoIP definition files (which IP addresses
36belong to which country) that are needed for Xtables-addons's xt_geoip
37module.
38
b7f9561d
JB
39%description -l pl.UTF-8
40Ten pakiet zawiera pliki definicji GeoIP (określające, które adresy IP
41należą do jakiego kraju), wymagane przez moduł xt_geoip z pakietu
42xtables-addons.
43
a9e058f3 44%prep
2ce9a429 45%setup -qc
265eb7e0
ER
46gunzip -c %{SOURCE1} > GeoIPv6.csv
47touch -r %{SOURCE1} GeoIPv6.csv
2ce9a429 48
1ea932eb
ER
49ver4=$(TZ=GMT stat -c '%y' GeoIPCountryWhois.csv | awk '{print $1}' | tr -d -)
50ver6=$(TZ=GMT stat -c '%y' GeoIPv6.csv | awk '{print $1}' | tr -d -)
265eb7e0
ER
51if [ "$ver4" -gt "$ver6" ]; then
52 ver=$ver4
53else
54 ver=$ver6
55fi
2ce9a429
ER
56if [ "$ver" != %{version} ]; then
57 exit 1
58fi
59
6bc81f82 60cp -p %{SOURCE2} .
2ce9a429
ER
61
62%build
a5459e86 63%{__perl} %{SOURCE3} GeoIPCountryWhois.csv GeoIPv6.csv | tee ranges.txt
a9e058f3 64
65%install
66rm -rf $RPM_BUILD_ROOT
a29328a9
ER
67install -d $RPM_BUILD_ROOT%{dbdir}
68cp -a %{byteorder} $RPM_BUILD_ROOT%{dbdir}
a9e058f3 69
2ec6929c
ER
70%if "%{pld_release}" == "ac"
71# handle older xtables in ac:
72# kernel-net-xtables-addons-1.18-15@2.6.27.53_1.amd64
73# still having old .iv0 names requirement
74# http://xtables-addons.git.sourceforge.net/git/gitweb.cgi?p=xtables-addons/xtables-addons;a=commitdiff;h=25bf680ead80e505d5073308f151b4007cb5683f
75# create hardlink, to be most compatible
76for a in $RPM_BUILD_ROOT%{dbdir}/%{byteorder}/*.iv4; do
77 ln $a ${a%.iv4}.iv0
78done
bc09a2c1
ER
79# kernel-net-xtables-addons-1.18-8@2.6.27.45_1.i686 searches from /var/lib:
80# Could not open /var/lib/geoip/LE/EE.iv0: No such file or directory
81install -d $RPM_BUILD_ROOT/var/lib
82ln -s %{_datadir}/xt_geoip $RPM_BUILD_ROOT/var/lib/geoip
2ec6929c
ER
83%endif
84
b7f9561d
JB
85%clean
86rm -rf $RPM_BUILD_ROOT
87
68d22166
ER
88%if "%{pld_release}" == "ac"
89%pretrans
90# this needs to be a symlink
91if [ -d /var/lib/geoip -a ! -L /var/lib/geoip ]; then
92 mv -f /var/lib/geoip{,.rpmsave}
0f946888
ER
93 install -d %{dbdir}
94 ln -s %{dbdir} /var/lib/geoip
68d22166
ER
95fi
96%endif
97
a9e058f3 98%files
99%defattr(644,root,root,755)
e399ee80 100%doc LICENSE.txt ranges.txt
377423bf
ER
101%dir %{dbdir}
102%{dbdir}/%{byteorder}
bc09a2c1
ER
103
104%if "%{pld_release}" == "ac"
105/var/lib/geoip
106%endif
This page took 0.090374 seconds and 4 git commands to generate.