]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # UPDATE WARNING: xtables-addons 3.0 support only kernels 4.15+ | |
3 | # xtables-addons 2.0 (XTADDONS_2 branch) support kernels 3.7 - 4.14 | |
4 | # | |
5 | # Conditional build: | |
6 | %bcond_without kernel # kernel modules | |
7 | %bcond_without userspace # userspace tools | |
8 | %bcond_with verbose # verbose build (V=1) | |
9 | ||
10 | # The goal here is to have main, userspace, package built once with | |
11 | # simple release number, and only rebuild kernel packages with kernel | |
12 | # version as part of release number, without the need to bump release | |
13 | # with every kernel change. | |
14 | %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace} | |
15 | %{error:kernel and userspace cannot be built at the same time on PLD builders} | |
16 | exit 1 | |
17 | %endif | |
18 | ||
19 | %if %{without userspace} | |
20 | # nothing to be placed to debuginfo package | |
21 | %define _enable_debug_packages 0 | |
22 | %endif | |
23 | ||
24 | %define rel 1 | |
25 | %define pname xtables-addons | |
26 | Summary: Additional extensions for xtables packet filtering system | |
27 | Summary(pl.UTF-8): Dodatkowe rozszerzenia do systemu filtrowania pakietów xtables | |
28 | Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} | |
29 | Version: 3.26 | |
30 | Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} | |
31 | License: GPL v2 | |
32 | Group: Networking/Admin | |
33 | Source0: https://inai.de/files/xtables-addons/%{pname}-%{version}.tar.xz | |
34 | # Source0-md5: afcec8d977631d224eaf87b27d51e77d | |
35 | URL: http://xtables-addons.sourceforge.net/ | |
36 | BuildRequires: autoconf >= 2.65 | |
37 | BuildRequires: automake >= 1:1.11 | |
38 | BuildRequires: iptables-devel >= 1.6.0 | |
39 | %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:4.18.0}} | |
40 | BuildRequires: libtool >= 2:2 | |
41 | BuildRequires: pkgconfig >= 1:0.9.0 | |
42 | BuildRequires: rpmbuild(macros) >= 1.746 | |
43 | BuildRequires: tar >= 1.22 | |
44 | BuildRequires: xz | |
45 | Requires: iptables >= 1.6.0 | |
46 | Obsoletes: iptables-ipp2p < 0.8.3 | |
47 | BuildRoot: %{tmpdir}/%{pname}-%{version}-root-%(id -u -n) | |
48 | ||
49 | %define _duplicate_files_terminate_build 0 | |
50 | ||
51 | %description | |
52 | xtables-addons is the proclaimed successor to patch-o-matic(-ng). It | |
53 | contains extensions that were not accepted in the main | |
54 | xtables/iptables package. | |
55 | ||
56 | For the tools to work, you should install kernel modules, which could | |
57 | be found in kernel*-net-xtables-addons. | |
58 | ||
59 | %description -l pl.UTF-8 | |
60 | xtables-addons to następca patch-o-matic(-ng). Zawiera rozszerzenia, | |
61 | które nie zostały zaakceptowane do głównego pakietu xtables/iptables. | |
62 | ||
63 | Aby narzędzia działały należy zainstalować moduły jądra, które można | |
64 | znaleźć w pakiecie kernel*-net-xtables-addons. | |
65 | ||
66 | %define kernel_pkg()\ | |
67 | %package -n kernel%{_alt_kernel}-net-xtables-addons\ | |
68 | Summary: Kernel modules for xtables addons\ | |
69 | Summary(pl.UTF-8): Moudły jądra dla rozszerzeń z pakietu xtables-addons\ | |
70 | Release: %{rel}@%{_kernel_ver_str}\ | |
71 | Group: Base/Kernel\ | |
72 | # VERSION only dependency is intentional, for allowing multiple kernel pkgs and\ | |
73 | # single userspace package installs.\ | |
74 | Requires: %{pname} = %{version}\ | |
75 | Suggests: xtables-geoip\ | |
76 | Conflicts: xtables-geoip < 20090901-2\ | |
77 | Requires(post,postun): /sbin/depmod\ | |
78 | %requires_releq_kernel\ | |
79 | Requires(postun): %releq_kernel\ | |
80 | \ | |
81 | %description -n kernel%{_alt_kernel}-net-xtables-addons\ | |
82 | Kernel modules for xtables addons.\ | |
83 | \ | |
84 | %description -n kernel%{_alt_kernel}-net-xtables-addons -l pl.UTF-8\ | |
85 | Moduły jądra dla rozszerzeń z pakietu xtables-addons.\ | |
86 | \ | |
87 | %files -n kernel%{_alt_kernel}-net-xtables-addons\ | |
88 | %defattr(644,root,root,755)\ | |
89 | # restricted permissions - may contain password\ | |
90 | %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/xt_sysrq.conf\ | |
91 | /lib/modules/%{_kernel_ver}/kernel/net/netfilter/compat_xtables.ko*\ | |
92 | /lib/modules/%{_kernel_ver}/kernel/net/netfilter/xt_*.ko*\ | |
93 | \ | |
94 | %post -n kernel%{_alt_kernel}-net-xtables-addons\ | |
95 | %depmod %{_kernel_ver}\ | |
96 | \ | |
97 | %postun -n kernel%{_alt_kernel}-net-xtables-addons\ | |
98 | %depmod %{_kernel_ver}\ | |
99 | %{nil} | |
100 | ||
101 | %define build_kernel_pkg()\ | |
102 | srcdir=${PWD:-$(pwd)}\ | |
103 | %build_kernel_modules XA_ABSTOPSRCDIR=$srcdir -C extensions -m compat_xtables\ | |
104 | for drv in extensions/compat_xtables.ko extensions/{ACCOUNT/,pknock/,}xt_*.ko ; do\ | |
105 | %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/netfilter\ | |
106 | done\ | |
107 | %{nil} | |
108 | ||
109 | %{?with_kernel:%{expand:%create_kernel_packages}} | |
110 | ||
111 | %prep | |
112 | %setup -q -n %{pname}-%{version} | |
113 | ||
114 | %build | |
115 | %configure \ | |
116 | --without-kbuild | |
117 | ||
118 | %{?with_kernel:%{expand:%build_kernel_packages}} | |
119 | ||
120 | %if %{with userspace} | |
121 | %{__make} \ | |
122 | V=1 | |
123 | %endif | |
124 | ||
125 | %install | |
126 | rm -rf $RPM_BUILD_ROOT | |
127 | ||
128 | %if %{with kernel} | |
129 | install -d $RPM_BUILD_ROOT/etc/modprobe.d | |
130 | ||
131 | cp -a installed/* $RPM_BUILD_ROOT | |
132 | ||
133 | cat <<'EOF' > $RPM_BUILD_ROOT/etc/modprobe.d/xt_sysrq.conf | |
134 | # Set password at modprobe time. This file is secure if properly guarded, | |
135 | # i.e only readable by root. | |
136 | #options xt_SYSRQ password=cookies | |
137 | ||
138 | # The hash algorithm can also be specified as a module option, for example, | |
139 | # to use SHA-256 instead of the default SHA-1: | |
140 | #options xt_SYSRQ hash=sha256 | |
141 | EOF | |
142 | %endif | |
143 | ||
144 | %if %{with userspace} | |
145 | %{__make} -C extensions install \ | |
146 | DESTDIR=$RPM_BUILD_ROOT | |
147 | %{__make} install-exec-am install-man \ | |
148 | DESTDIR=$RPM_BUILD_ROOT | |
149 | ||
150 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/libxt_ACCOUNT_cl.{la,so} | |
151 | %endif | |
152 | ||
153 | %clean | |
154 | rm -rf $RPM_BUILD_ROOT | |
155 | ||
156 | %post -p /sbin/ldconfig | |
157 | %postun -p /sbin/ldconfig | |
158 | ||
159 | %if %{with userspace} | |
160 | %files | |
161 | %defattr(644,root,root,755) | |
162 | %doc README.rst doc/{README.psd,changelog.rst} | |
163 | %attr(755,root,root) %{_bindir}/xt_geoip_query | |
164 | %attr(755,root,root) %{_sbindir}/iptaccount | |
165 | %attr(755,root,root) %{_sbindir}/pknlusr | |
166 | %attr(755,root,root) %{_libdir}/libxt_ACCOUNT_cl.so.*.*.* | |
167 | %attr(755,root,root) %ghost %{_libdir}/libxt_ACCOUNT_cl.so.1 | |
168 | %attr(755,root,root) %{_libdir}/xtables/libxt_*.so | |
169 | %dir %{_libexecdir}/xtables-addons | |
170 | %attr(755,root,root) %{_libexecdir}/xtables-addons/xt_asn_build | |
171 | %attr(755,root,root) %{_libexecdir}/xtables-addons/xt_asn_dl | |
172 | %attr(755,root,root) %{_libexecdir}/xtables-addons/xt_asn_fetch | |
173 | %attr(755,root,root) %{_libexecdir}/xtables-addons/xt_geoip_build | |
174 | %attr(755,root,root) %{_libexecdir}/xtables-addons/xt_geoip_build_maxmind | |
175 | %attr(755,root,root) %{_libexecdir}/xtables-addons/xt_geoip_dl | |
176 | %attr(755,root,root) %{_libexecdir}/xtables-addons/xt_geoip_dl_maxmind | |
177 | %{_mandir}/man1/xt_asn_build.1* | |
178 | %{_mandir}/man1/xt_asn_dl.1* | |
179 | %{_mandir}/man1/xt_geoip_build.1* | |
180 | %{_mandir}/man1/xt_geoip_build_maxmind.1* | |
181 | %{_mandir}/man1/xt_geoip_dl.1* | |
182 | %{_mandir}/man1/xt_geoip_dl_maxmind.1* | |
183 | %{_mandir}/man1/xt_geoip_query.1* | |
184 | %{_mandir}/man8/iptaccount.8* | |
185 | %{_mandir}/man8/xtables-addons.8* | |
186 | %{_mandir}/man8/pknlusr.8* | |
187 | %endif |