]>
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 |
0b25bb47 | 9 | %bcond_with verbose # verbose build (V=1) |
64731849 TP |
10 | |
11 | %if %{without kernel} | |
12 | %undefine with_dist_kernel | |
13 | %endif | |
0b25bb47 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 | ||
64731849 | 24 | %if "%{_alt_kernel}" != "%{nil}" |
0b25bb47 JR |
25 | %if 0%{?build_kernels:1} |
26 | %{error:alt_kernel and build_kernels are mutually exclusive} | |
27 | exit 1 | |
28 | %endif | |
64731849 | 29 | %undefine with_userspace |
0b25bb47 JR |
30 | %global _build_kernels %{alt_kernel} |
31 | %else | |
32 | %global _build_kernels %{?build_kernels:,%{?build_kernels}} | |
64731849 | 33 | %endif |
0b25bb47 | 34 | |
64731849 TP |
35 | %if %{without userspace} |
36 | # nothing to be placed to debuginfo package | |
37 | %define _enable_debug_packages 0 | |
38 | %endif | |
39 | ||
47695ee3 | 40 | %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:3.7.0" ; done) |
0b25bb47 JR |
41 | %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) |
42 | %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) | |
43 | ||
7bdade5e | 44 | %define rel 1 |
e0de918a | 45 | %define pname xtables-addons |
fff03056 JB |
46 | Summary: Additional extensions for xtables packet filtering system |
47 | Summary(pl.UTF-8): Dodatkowe rozszerzenia do systemu filtrowania pakietów xtables | |
0b25bb47 | 48 | Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} |
7bdade5e | 49 | Version: 2.5 |
0b25bb47 | 50 | Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} |
fff03056 | 51 | License: GPL v2 |
64731849 | 52 | Group: Networking/Admin |
e0de918a | 53 | Source0: http://downloads.sourceforge.net/xtables-addons/%{pname}-%{version}.tar.xz |
7bdade5e | 54 | # Source0-md5: 335663ece5fb17c7d0bb24dbdc697eb1 |
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 |
0b25bb47 | 59 | %{?with_dist_kernel:%{expand:%kbrs}} |
011c75bf | 60 | BuildRequires: libtool |
a88a87ac | 61 | BuildRequires: pkgconfig >= 0.9.0 |
0b25bb47 | 62 | BuildRequires: rpmbuild(macros) >= 1.678 |
a88a87ac TP |
63 | BuildRequires: tar >= 1.22 |
64 | BuildRequires: xz | |
84da2698 | 65 | Requires: iptables >= 1.4.5 |
3a1015f9 | 66 | Obsoletes: iptables-ipp2p |
e0de918a | 67 | BuildRoot: %{tmpdir}/%{pname}-%{version}-root-%(id -u -n) |
2741a7bf | 68 | |
63cac0db JR |
69 | %define _duplicate_files_terminate_build 0 |
70 | ||
2741a7bf | 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 |
0b25bb47 | 77 | be found in kernel*-net-xtables-addons. |
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 |
0b25bb47 JR |
84 | znaleźć w pakiecie kernel*-net-xtables-addons. |
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\ | |
0b25bb47 JR |
113 | /lib/modules/%{_kernel_ver}/kernel/net/netfilter/compat_xtables.ko*\ |
114 | /lib/modules/%{_kernel_ver}/kernel/net/netfilter/xt_*.ko*\ | |
115 | \ | |
116 | %post -n kernel%{_alt_kernel}-net-xtables-addons\ | |
117 | %depmod %{_kernel_ver}\ | |
118 | \ | |
119 | %postun -n kernel%{_alt_kernel}-net-xtables-addons\ | |
120 | %depmod %{_kernel_ver}\ | |
121 | %{nil} | |
122 | ||
123 | %define build_kernel_pkg()\ | |
124 | srcdir=${PWD:-$(pwd)}\ | |
125 | %build_kernel_modules XA_ABSTOPSRCDIR=$srcdir -C extensions -m compat_xtables\ | |
0b25bb47 JR |
126 | for drv in extensions/compat_xtables.ko extensions/{ACCOUNT/,pknock/,}xt_*.ko ; do\ |
127 | %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/netfilter\ | |
128 | done\ | |
129 | %{nil} | |
130 | ||
131 | %{?with_kernel:%{expand:%kpkg}} | |
e3c9233c | 132 | |
2741a7bf | 133 | %prep |
69b400ea | 134 | %setup -q -n %{pname}-%{version} |
2741a7bf AM |
135 | |
136 | %build | |
137 | %configure \ | |
83cb19e1 | 138 | --without-kbuild |
7ad03426 | 139 | |
0b25bb47 | 140 | %{?with_kernel:%{expand:%bkpkg}} |
7ad03426 | 141 | |
142 | %if %{with userspace} | |
60cfc309 JB |
143 | %{__make} \ |
144 | V=1 | |
7ad03426 | 145 | %endif |
2741a7bf AM |
146 | |
147 | %install | |
148 | rm -rf $RPM_BUILD_ROOT | |
149 | ||
7ad03426 | 150 | %if %{with kernel} |
329d0a27 | 151 | install -d $RPM_BUILD_ROOT/etc/modprobe.d |
0b25bb47 JR |
152 | |
153 | cp -a installed/* $RPM_BUILD_ROOT | |
154 | ||
fd71b2e3 | 155 | cat <<'EOF' > $RPM_BUILD_ROOT/etc/modprobe.d/xt_sysrq.conf |
fff03056 | 156 | # Set password at modprobe time. This file is secure if properly guarded, |
fd71b2e3 ER |
157 | # i.e only readable by root. |
158 | #options xt_SYSRQ password=cookies | |
159 | ||
329d0a27 JR |
160 | # The hash algorithm can also be specified as a module option, for example, |
161 | # to use SHA-256 instead of the default SHA-1: | |
fd71b2e3 ER |
162 | #options xt_SYSRQ hash=sha256 |
163 | EOF | |
60cfc309 JB |
164 | %endif |
165 | ||
166 | %if %{with userspace} | |
167 | %{__make} -C extensions install \ | |
168 | DESTDIR=$RPM_BUILD_ROOT | |
16932b07 JB |
169 | %{__make} install-man \ |
170 | DESTDIR=$RPM_BUILD_ROOT | |
60cfc309 JB |
171 | |
172 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/libxt_ACCOUNT_cl.{la,so} | |
60cfc309 | 173 | %endif |
fd71b2e3 | 174 | |
2741a7bf AM |
175 | %clean |
176 | rm -rf $RPM_BUILD_ROOT | |
177 | ||
a88a87ac | 178 | %post -p /sbin/ldconfig |
8f462252 AM |
179 | %postun -p /sbin/ldconfig |
180 | ||
64731849 | 181 | %if %{with userspace} |
2741a7bf AM |
182 | %files |
183 | %defattr(644,root,root,755) | |
83cb19e1 | 184 | %doc README doc/{README.psd,changelog.txt} |
8f462252 | 185 | %attr(755,root,root) %{_sbindir}/iptaccount |
60cfc309 JB |
186 | %attr(755,root,root) %{_libdir}/libxt_ACCOUNT_cl.so.*.*.* |
187 | %attr(755,root,root) %ghost %{_libdir}/libxt_ACCOUNT_cl.so.0 | |
edb92c36 | 188 | %attr(755,root,root) %{_libdir}/xtables/libxt_*.so |
32aaedb1 | 189 | %{_mandir}/man8/iptaccount.8* |
8af0bca6 | 190 | %{_mandir}/man8/xtables-addons.8* |
7ad03426 | 191 | %endif |