2 # UPDATE WARNING: xtables-addons 3.0 support only kernels 4.15+
5 %bcond_without kernel # don't build kernel modules
6 %bcond_without userspace # don't build userspace tools
7 %bcond_with verbose # verbose build (V=1)
9 # The goal here is to have main, userspace, package built once with
10 # simple release number, and only rebuild kernel packages with kernel
11 # version as part of release number, without the need to bump release
12 # with every kernel change.
13 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
14 %{error:kernel and userspace cannot be built at the same time on PLD builders}
18 %if %{without userspace}
19 # nothing to be placed to debuginfo package
20 %define _enable_debug_packages 0
24 %define pname xtables-addons
25 Summary: Additional extensions for xtables packet filtering system
26 Summary(pl.UTF-8): Dodatkowe rozszerzenia do systemu filtrowania pakietów xtables
27 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
29 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
31 Group: Networking/Admin
32 Source0: http://downloads.sourceforge.net/xtables-addons/%{pname}-%{version}.tar.xz
33 # Source0-md5: a77d2fc2151eed97f903d7905640e549
34 URL: http://xtables-addons.sourceforge.net/
35 BuildRequires: autoconf >= 2.65
36 BuildRequires: automake >= 1:1.11
37 BuildRequires: iptables-devel >= 1.4.5
38 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:4.15.0}}
39 BuildRequires: libtool
40 BuildRequires: pkgconfig >= 0.9.0
41 BuildRequires: rpmbuild(macros) >= 1.678
42 BuildRequires: tar >= 1.22
44 Requires: iptables >= 1.4.5
45 Obsoletes: iptables-ipp2p
46 BuildRoot: %{tmpdir}/%{pname}-%{version}-root-%(id -u -n)
48 %define _duplicate_files_terminate_build 0
51 xtables-addons is the proclaimed successor to patch-o-matic(-ng). It
52 contains extensions that were not accepted in the main
53 xtables/iptables package.
55 For the tools to work, you should install kernel modules, which could
56 be found in kernel*-net-xtables-addons.
58 %description -l pl.UTF-8
59 xtables-addons to następca patch-o-matic(-ng). Zawiera rozszerzenia,
60 które nie zostały zaakceptowane do głównego pakietu xtables/iptables.
62 Aby narzędzia działały należy zainstalować moduły jądra, które można
63 znaleźć w pakiecie kernel*-net-xtables-addons.
66 %package -n kernel%{_alt_kernel}-net-xtables-addons\
67 Summary: Kernel modules for xtables addons\
68 Summary(pl.UTF-8): Moudły jądra dla rozszerzeń z pakietu xtables-addons\
69 Release: %{rel}@%{_kernel_ver_str}\
71 # VERSION only dependency is intentional, for allowing multiple kernel pkgs and\
72 # single userspace package installs.\
73 Requires: %{pname} = %{version}\
74 Suggests: xtables-geoip\
75 Conflicts: xtables-geoip < 20090901-2\
76 Requires(post,postun): /sbin/depmod\
77 %requires_releq_kernel\
78 Requires(postun): %releq_kernel\
80 %description -n kernel%{_alt_kernel}-net-xtables-addons\
81 Kernel modules for xtables addons.\
83 %description -n kernel%{_alt_kernel}-net-xtables-addons -l pl.UTF-8\
84 Moduły jądra dla rozszerzeń z pakietu xtables-addons.\
86 %files -n kernel%{_alt_kernel}-net-xtables-addons\
87 %defattr(644,root,root,755)\
88 # restricted permissions - may contain password\
89 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/xt_sysrq.conf\
90 /lib/modules/%{_kernel_ver}/kernel/net/netfilter/compat_xtables.ko*\
91 /lib/modules/%{_kernel_ver}/kernel/net/netfilter/xt_*.ko*\
93 %post -n kernel%{_alt_kernel}-net-xtables-addons\
94 %depmod %{_kernel_ver}\
96 %postun -n kernel%{_alt_kernel}-net-xtables-addons\
97 %depmod %{_kernel_ver}\
100 %define build_kernel_pkg()\
101 srcdir=${PWD:-$(pwd)}\
102 %build_kernel_modules XA_ABSTOPSRCDIR=$srcdir -C extensions -m compat_xtables\
103 for drv in extensions/compat_xtables.ko extensions/{ACCOUNT/,pknock/,}xt_*.ko ; do\
104 %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/netfilter\
108 %{?with_kernel:%{expand:%create_kernel_packages}}
111 %setup -q -n %{pname}-%{version}
117 %{?with_kernel:%{expand:%build_kernel_packages}}
119 %if %{with userspace}
125 rm -rf $RPM_BUILD_ROOT
128 install -d $RPM_BUILD_ROOT/etc/modprobe.d
130 cp -a installed/* $RPM_BUILD_ROOT
132 cat <<'EOF' > $RPM_BUILD_ROOT/etc/modprobe.d/xt_sysrq.conf
133 # Set password at modprobe time. This file is secure if properly guarded,
134 # i.e only readable by root.
135 #options xt_SYSRQ password=cookies
137 # The hash algorithm can also be specified as a module option, for example,
138 # to use SHA-256 instead of the default SHA-1:
139 #options xt_SYSRQ hash=sha256
143 %if %{with userspace}
144 %{__make} -C extensions install \
145 DESTDIR=$RPM_BUILD_ROOT
146 %{__make} install-man \
147 DESTDIR=$RPM_BUILD_ROOT
149 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libxt_ACCOUNT_cl.{la,so}
153 rm -rf $RPM_BUILD_ROOT
155 %post -p /sbin/ldconfig
156 %postun -p /sbin/ldconfig
158 %if %{with userspace}
160 %defattr(644,root,root,755)
161 %doc README doc/{README.psd,changelog.txt}
162 %attr(755,root,root) %{_sbindir}/iptaccount
163 %attr(755,root,root) %{_libdir}/libxt_ACCOUNT_cl.so.*.*.*
164 %attr(755,root,root) %ghost %{_libdir}/libxt_ACCOUNT_cl.so.0
165 %attr(755,root,root) %{_libdir}/xtables/libxt_*.so
166 %{_mandir}/man8/iptaccount.8*
167 %{_mandir}/man8/xtables-addons.8*