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