]> git.pld-linux.org Git - packages/xtables-geoip.git/blame - xtables-geoip.spec
- up to 20120808
[packages/xtables-geoip.git] / xtables-geoip.spec
CommitLineData
a9e058f3 1Summary: GeoIP database files for xt_geoip
2Name: xtables-geoip
22f072b8 3Version: 20120808
265eb7e0 4Release: 1
2ce9a429 5License: GPL, Open Data License
a9e058f3 6Group: Networking/Admin
2a48ce95 7URL: http://www.maxmind.com/
14600c7f 8Source0: http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
22f072b8 9# Source0-md5: 65f96d32d1aa83c4ceadfc98b778cddf
a24c8ed7 10Source1: http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz
22f072b8 11# Source1-md5: d6e2e96ab35dffd82dd4d64d9e82af9b
a24c8ed7
JR
12Source2: http://geolite.maxmind.com/download/geoip/database/LICENSE.txt
13# Source2-md5: a1381bd1aa0a0c91dc31b3f1e847cf4a
14Source3: http://xtables-addons.git.sourceforge.net/git/gitweb.cgi?p=xtables-addons/xtables-addons;a=blob_plain;f=geoip/xt_geoip_build
68978faf 15# Source3-md5: 76c6959bad03c1ff064aefcb4811cd92
e77737fd 16BuildRequires: perl-Text-CSV_XS >= 0.69
2ce9a429 17BuildRequires: perl-base
2ec6929c 18BuildRequires: rpm >= 4.4.9-56
3be77cb9 19BuildRequires: unzip
a9e058f3 20BuildRoot: %{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
34The package contains the GeoIP definition files (which IP addresses
35belong to which country) that are needed for Xtables-addons's xt_geoip
36module.
37
38%prep
2ce9a429 39%setup -qc
265eb7e0
ER
40gunzip -c %{SOURCE1} > GeoIPv6.csv
41touch -r %{SOURCE1} GeoIPv6.csv
2ce9a429 42
265eb7e0
ER
43ver4=$(stat -c '%y' GeoIPCountryWhois.csv | awk '{print $1}' | tr -d -)
44ver6=$(stat -c '%y' GeoIPv6.csv | awk '{print $1}' | tr -d -)
45if [ "$ver4" -gt "$ver6" ]; then
46 ver=$ver4
47else
48 ver=$ver6
49fi
2ce9a429
ER
50if [ "$ver" != %{version} ]; then
51 exit 1
52fi
53
6bc81f82 54cp -p %{SOURCE2} .
2ce9a429
ER
55
56%build
a5459e86 57%{__perl} %{SOURCE3} GeoIPCountryWhois.csv GeoIPv6.csv | tee ranges.txt
a9e058f3 58
59%install
60rm -rf $RPM_BUILD_ROOT
a29328a9
ER
61install -d $RPM_BUILD_ROOT%{dbdir}
62cp -a %{byteorder} $RPM_BUILD_ROOT%{dbdir}
a9e058f3 63
2ec6929c
ER
64%if "%{pld_release}" == "ac"
65# handle older xtables in ac:
66# kernel-net-xtables-addons-1.18-15@2.6.27.53_1.amd64
67# still having old .iv0 names requirement
68# http://xtables-addons.git.sourceforge.net/git/gitweb.cgi?p=xtables-addons/xtables-addons;a=commitdiff;h=25bf680ead80e505d5073308f151b4007cb5683f
69# create hardlink, to be most compatible
70for a in $RPM_BUILD_ROOT%{dbdir}/%{byteorder}/*.iv4; do
71 ln $a ${a%.iv4}.iv0
72done
bc09a2c1
ER
73# kernel-net-xtables-addons-1.18-8@2.6.27.45_1.i686 searches from /var/lib:
74# Could not open /var/lib/geoip/LE/EE.iv0: No such file or directory
75install -d $RPM_BUILD_ROOT/var/lib
76ln -s %{_datadir}/xt_geoip $RPM_BUILD_ROOT/var/lib/geoip
2ec6929c
ER
77%endif
78
68d22166
ER
79%if "%{pld_release}" == "ac"
80%pretrans
81# this needs to be a symlink
82if [ -d /var/lib/geoip -a ! -L /var/lib/geoip ]; then
83 mv -f /var/lib/geoip{,.rpmsave}
0f946888
ER
84 install -d %{dbdir}
85 ln -s %{dbdir} /var/lib/geoip
68d22166
ER
86fi
87%endif
88
a9e058f3 89%clean
90rm -rf $RPM_BUILD_ROOT
91
92%files
93%defattr(644,root,root,755)
e399ee80 94%doc LICENSE.txt ranges.txt
377423bf
ER
95%dir %{dbdir}
96%{dbdir}/%{byteorder}
bc09a2c1
ER
97
98%if "%{pld_release}" == "ac"
99/var/lib/geoip
100%endif
This page took 0.041996 seconds and 4 git commands to generate.