]> git.pld-linux.org Git - packages/xtables-geoip.git/blame_incremental - xtables-geoip.spec
update xt_geoip_build script
[packages/xtables-geoip.git] / xtables-geoip.spec
... / ...
CommitLineData
1Summary: GeoIP database files for xt_geoip
2Summary(pl.UTF-8): Pliki baz danych GeoIP dla xt_geoip
3Name: xtables-geoip
4Version: 20140205
5Release: 1
6License: GPL, Open Data License
7Group: Networking/Admin
8Source0: http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
9# Source0-md5: 4f1831b705da70a4db66d71e9c4c7e6c
10Source1: http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz
11# Source1-md5: fa19e7a8e50f3fb71f6fe14e539b402a
12Source2: http://geolite.maxmind.com/download/geoip/database/LICENSE.txt
13# Source2-md5: a1381bd1aa0a0c91dc31b3f1e847cf4a
14Source3: http://sourceforge.net/p/xtables-addons/xtables-addons/ci/master/tree/geoip/xt_geoip_build?format=raw&/xt_geoip_build
15# Source3-md5: 4dcd62c8b2c8b90cc88e961613118be3
16URL: http://www.maxmind.com/
17BuildRequires: perl-Text-CSV_XS >= 0.69
18BuildRequires: perl-base
19BuildRequires: rpm >= 4.4.9-56
20BuildRequires: unzip
21BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
22
23%define dbdir /usr/share/xt_geoip
24
25# no debuginfo to package
26%define _enable_debug_packages 0
27
28%ifarch ppc ppc64 s390 s390x sparc sparc64 sparcv9
29%define byteorder BE
30%else
31%define byteorder LE
32%endif
33
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
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
44%prep
45%setup -qc
46gunzip -c %{SOURCE1} > GeoIPv6.csv
47touch -r %{SOURCE1} GeoIPv6.csv
48
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 -)
51if [ "$ver4" -gt "$ver6" ]; then
52 ver=$ver4
53else
54 ver=$ver6
55fi
56if [ "$ver" != %{version} ]; then
57 exit 1
58fi
59
60cp -p %{SOURCE2} .
61
62%build
63%{__perl} %{SOURCE3} GeoIPCountryWhois.csv GeoIPv6.csv | tee ranges.txt
64
65%install
66rm -rf $RPM_BUILD_ROOT
67install -d $RPM_BUILD_ROOT%{dbdir}
68cp -a %{byteorder} $RPM_BUILD_ROOT%{dbdir}
69
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
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
83%endif
84
85%clean
86rm -rf $RPM_BUILD_ROOT
87
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}
93 install -d %{dbdir}
94 ln -s %{dbdir} /var/lib/geoip
95fi
96%endif
97
98%files
99%defattr(644,root,root,755)
100%doc LICENSE.txt ranges.txt
101%dir %{dbdir}
102%{dbdir}/%{byteorder}
103
104%if "%{pld_release}" == "ac"
105/var/lib/geoip
106%endif
This page took 0.062495 seconds and 4 git commands to generate.