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