]>
Commit | Line | Data |
---|---|---|
a9e058f3 | 1 | Summary: GeoIP database files for xt_geoip |
2 | Name: xtables-geoip | |
de265bfc | 3 | Version: 20120501 |
6bc81f82 | 4 | Release: 1 |
2ce9a429 | 5 | License: GPL, Open Data License |
a9e058f3 | 6 | Group: Networking/Admin |
2a48ce95 | 7 | URL: http://www.maxmind.com/ |
14600c7f | 8 | Source0: http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip |
de265bfc | 9 | # Source0-md5: 9b2bbd5f39fafa52ade4f339babf394a |
a24c8ed7 | 10 | Source1: http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz |
de265bfc | 11 | # Source1-md5: f8f0130ea32d8e7b7bfc349f751ccee5 |
a24c8ed7 JR |
12 | Source2: http://geolite.maxmind.com/download/geoip/database/LICENSE.txt |
13 | # Source2-md5: a1381bd1aa0a0c91dc31b3f1e847cf4a | |
14 | Source3: http://xtables-addons.git.sourceforge.net/git/gitweb.cgi?p=xtables-addons/xtables-addons;a=blob_plain;f=geoip/xt_geoip_build | |
15 | # Source3-md5: 9933235c5d9c4c7fbad965d6317f8c2f | |
e77737fd | 16 | BuildRequires: perl-Text-CSV_XS >= 0.69 |
2ce9a429 | 17 | BuildRequires: perl-base |
2ec6929c | 18 | BuildRequires: rpm >= 4.4.9-56 |
3be77cb9 | 19 | BuildRequires: unzip |
a9e058f3 | 20 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
21 | ||
1f56ba0c ER |
22 | %define dbdir /usr/share/xt_geoip |
23 | ||
14600c7f ER |
24 | # no debuginfo to package |
25 | %define _enable_debug_packages 0 | |
26 | ||
377423bf ER |
27 | %ifarch ppc sparc ppc64 sparc64 sparcv9 |
28 | %define byteorder BE | |
29 | %else | |
30 | %define byteorder LE | |
31 | %endif | |
32 | ||
a9e058f3 | 33 | %description |
34 | The package contains the GeoIP definition files (which IP addresses | |
35 | belong to which country) that are needed for Xtables-addons's xt_geoip | |
36 | module. | |
37 | ||
38 | %prep | |
2ce9a429 | 39 | %setup -qc |
2ce9a429 ER |
40 | |
41 | ver=$(stat -c '%y' GeoIPCountryWhois.csv | awk '{print $1}' | tr -d -) | |
42 | if [ "$ver" != %{version} ]; then | |
43 | exit 1 | |
44 | fi | |
45 | ||
a24c8ed7 | 46 | gunzip -c %{SOURCE1} >GeoIPv6.csv |
6bc81f82 | 47 | cp -p %{SOURCE2} . |
2ce9a429 ER |
48 | |
49 | %build | |
a5459e86 | 50 | %{__perl} %{SOURCE3} GeoIPCountryWhois.csv GeoIPv6.csv | tee ranges.txt |
a9e058f3 | 51 | |
52 | %install | |
53 | rm -rf $RPM_BUILD_ROOT | |
a29328a9 ER |
54 | install -d $RPM_BUILD_ROOT%{dbdir} |
55 | cp -a %{byteorder} $RPM_BUILD_ROOT%{dbdir} | |
a9e058f3 | 56 | |
2ec6929c ER |
57 | %if "%{pld_release}" == "ac" |
58 | # handle older xtables in ac: | |
59 | # kernel-net-xtables-addons-1.18-15@2.6.27.53_1.amd64 | |
60 | # still having old .iv0 names requirement | |
61 | # http://xtables-addons.git.sourceforge.net/git/gitweb.cgi?p=xtables-addons/xtables-addons;a=commitdiff;h=25bf680ead80e505d5073308f151b4007cb5683f | |
62 | # create hardlink, to be most compatible | |
63 | for a in $RPM_BUILD_ROOT%{dbdir}/%{byteorder}/*.iv4; do | |
64 | ln $a ${a%.iv4}.iv0 | |
65 | done | |
bc09a2c1 ER |
66 | # kernel-net-xtables-addons-1.18-8@2.6.27.45_1.i686 searches from /var/lib: |
67 | # Could not open /var/lib/geoip/LE/EE.iv0: No such file or directory | |
68 | install -d $RPM_BUILD_ROOT/var/lib | |
69 | ln -s %{_datadir}/xt_geoip $RPM_BUILD_ROOT/var/lib/geoip | |
2ec6929c ER |
70 | %endif |
71 | ||
a9e058f3 | 72 | %clean |
73 | rm -rf $RPM_BUILD_ROOT | |
74 | ||
75 | %files | |
76 | %defattr(644,root,root,755) | |
e399ee80 | 77 | %doc LICENSE.txt ranges.txt |
377423bf ER |
78 | %dir %{dbdir} |
79 | %{dbdir}/%{byteorder} | |
bc09a2c1 ER |
80 | |
81 | %if "%{pld_release}" == "ac" | |
82 | /var/lib/geoip | |
83 | %endif |