]> git.pld-linux.org Git - packages/xtables-geoip.git/blob - xtables-geoip.spec
de9203f1e9b66c7993e2982b98d7364a6a883a07
[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:        20181024
5 Release:        1
6 License:        GPL, Open Data License
7 Group:          Networking/Admin
8 Source0:        http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
9 # Source0-md5:  4e22dd36f85737f45f8595d0ba1f2e85
10 Source1:        http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz
11 # Source1-md5:  f546eba297b1f325e22a7a20542b61d7
12 Source2:        http://geolite.maxmind.com/download/geoip/database/LICENSE.txt
13 # Source2-md5:  a1381bd1aa0a0c91dc31b3f1e847cf4a
14 Source3:        http://sourceforge.net/p/xtables-addons/xtables-addons/ci/master/tree/geoip/xt_geoip_build?format=raw&/xt_geoip_build
15 # Source3-md5:  4dcd62c8b2c8b90cc88e961613118be3
16 URL:            http://www.maxmind.com/
17 BuildRequires:  perl-Text-CSV_XS >= 0.69
18 BuildRequires:  perl-base
19 BuildRequires:  rpm >= 4.4.9-56
20 BuildRequires:  unzip
21 BuildRoot:      %{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
35 The package contains the GeoIP definition files (which IP addresses
36 belong to which country) that are needed for Xtables-addons's xt_geoip
37 module.
38
39 %description -l pl.UTF-8
40 Ten pakiet zawiera pliki definicji GeoIP (określające, które adresy IP
41 należą do jakiego kraju), wymagane przez moduł xt_geoip z pakietu
42 xtables-addons.
43
44 %prep
45 %setup -qc
46 gunzip -c %{SOURCE1} > GeoIPv6.csv
47 touch -r %{SOURCE1} GeoIPv6.csv
48
49 ver4=$(TZ=GMT stat -c '%y' GeoIPCountryWhois.csv | awk '{print $1}' | tr -d -)
50 ver6=$(TZ=GMT stat -c '%y' GeoIPv6.csv | awk '{print $1}' | tr -d -)
51 if [ "$ver4" -gt "$ver6" ]; then
52         ver=$ver4
53 else
54         ver=$ver6
55 fi
56 if [ "$ver" != %{version} ]; then
57         exit 1
58 fi
59
60 cp -p %{SOURCE2} .
61
62 %build
63 %{__perl} %{SOURCE3} GeoIPCountryWhois.csv GeoIPv6.csv | tee ranges.txt
64
65 %install
66 rm -rf $RPM_BUILD_ROOT
67 install -d $RPM_BUILD_ROOT%{dbdir}
68 cp -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
76 for a in $RPM_BUILD_ROOT%{dbdir}/%{byteorder}/*.iv4; do
77         ln $a ${a%.iv4}.iv0
78 done
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
81 install -d $RPM_BUILD_ROOT/var/lib
82 ln -s %{_datadir}/xt_geoip $RPM_BUILD_ROOT/var/lib/geoip
83 %endif
84
85 %clean
86 rm -rf $RPM_BUILD_ROOT
87
88 %if "%{pld_release}" == "ac"
89 %pretrans
90 # this needs to be a symlink
91 if [ -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
95 fi
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.05597 seconds and 2 git commands to generate.