]> git.pld-linux.org Git - packages/xtables-geoip.git/blob - xtables-geoip.spec
5f76f90b51b5321c66c904086adbe389a1222ead
[packages/xtables-geoip.git] / xtables-geoip.spec
1 Summary:        GeoIP database files for xt_geoip
2 Summary(pl.UTF-8):      Pliki baz danych GeoIP dla xt_geoip
3 Name:           xtables-geoip
4 Version:        20181023
5 Release:        1
6 License:        GPL, Open Data License
7 Group:          Networking/Admin
8 Source0:        http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip
9 # Source0-md5:  1f5524d5ac54a779831bffc57d91e2a2
10 Source1:        http://geolite.maxmind.com/download/geoip/database/LICENSE.txt
11 # Source1-md5:  a1381bd1aa0a0c91dc31b3f1e847cf4a
12 Source2:        http://sourceforge.net/p/xtables-addons/xtables-addons/ci/master/tree/geoip/xt_geoip_build?format=raw&/xt_geoip_build
13 # Source2-md5:  462ca00be38471d19dc6e0f32c098275
14 URL:            http://www.maxmind.com/
15 BuildRequires:  perl-Text-CSV_XS >= 0.69
16 BuildRequires:  perl-base
17 BuildRequires:  rpm >= 4.4.9-56
18 BuildRequires:  unzip
19 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
20
21 %define         dbdir   /usr/share/xt_geoip
22
23 # no debuginfo to package
24 %define         _enable_debug_packages  0
25
26 %description
27 The package contains the GeoIP definition files (which IP addresses
28 belong to which country) that are needed for Xtables-addons's xt_geoip
29 module.
30
31 %description -l pl.UTF-8
32 Ten pakiet zawiera pliki definicji GeoIP (określające, które adresy IP
33 należą do jakiego kraju), wymagane przez moduł xt_geoip z pakietu
34 xtables-addons.
35
36 %prep
37 %setup -qc
38
39 ver=$(ls -d GeoLite2-Country-CSV_* | head -1 | %{__sed} 's/^GeoLite2-Country-CSV_//')
40 if [ "$ver" != %{version} ]; then
41         exit 1
42 fi
43
44 cp -p %{SOURCE1} .
45
46 %build
47 %{__mkdir} out
48 %{__perl} %{SOURCE2} -S GeoLite2-Country-CSV_%{version} -D out > ranges.txt
49
50 %install
51 rm -rf $RPM_BUILD_ROOT
52 install -d $RPM_BUILD_ROOT%{dbdir}
53 cp -a out/* $RPM_BUILD_ROOT%{dbdir}
54
55 %if "%{pld_release}" == "ac"
56 # handle older xtables in ac:
57 # kernel-net-xtables-addons-1.18-15@2.6.27.53_1.amd64
58 # still having old .iv0 names requirement
59 # http://xtables-addons.git.sourceforge.net/git/gitweb.cgi?p=xtables-addons/xtables-addons;a=commitdiff;h=25bf680ead80e505d5073308f151b4007cb5683f
60 # create hardlink, to be most compatible
61 for a in $RPM_BUILD_ROOT%{dbdir}/*.iv4; do
62         ln $a ${a%.iv4}.iv0
63 done
64 # kernel-net-xtables-addons-1.18-8@2.6.27.45_1.i686  searches from /var/lib:
65 # Could not open /var/lib/geoip/LE/EE.iv0: No such file or directory
66 install -d $RPM_BUILD_ROOT/var/lib
67 ln -s %{_datadir}/xt_geoip $RPM_BUILD_ROOT/var/lib/geoip
68 %endif
69
70 %clean
71 rm -rf $RPM_BUILD_ROOT
72
73 %if "%{pld_release}" == "ac"
74 %pretrans
75 # this needs to be a symlink
76 if [ -d /var/lib/geoip -a ! -L /var/lib/geoip ]; then
77         mv -f /var/lib/geoip{,.rpmsave}
78         install -d %{dbdir}
79         ln -s %{dbdir} /var/lib/geoip
80 fi
81 %endif
82
83 %files
84 %defattr(644,root,root,755)
85 %doc LICENSE.txt ranges.txt
86 %{dbdir}
87
88 %if "%{pld_release}" == "ac"
89 /var/lib/geoip
90 %endif
This page took 0.03412 seconds and 2 git commands to generate.