3 %bcond_without dist_kernel # allow non-distribution kernel
4 %bcond_without kernel # don't build kernel modules
5 %bcond_without userspace # don't build userspace tools
6 %bcond_with verbose # verbose build (V=1)
9 %undefine with_dist_kernel
11 %if "%{_alt_kernel}" != "%{nil}"
12 %undefine with_userspace
14 %if %{without userspace}
15 # nothing to be placed to debuginfo package
16 %define _enable_debug_packages 0
21 Summary: IP sets utility
22 Summary(pl.UTF-8): Narzędzie do zarządzania zbiorami IP
23 Name: %{pname}%{_alt_kernel}
27 Group: Networking/Admin
28 Source0: http://ipset.netfilter.org/%{pname}-%{version}.tar.bz2
29 # Source0-md5: 9060d549a18c1c0794fa47a71343d627
30 Source1: %{pname}.init
31 Patch0: shadow-args.patch
32 URL: http://ipset.netfilter.org/
33 %{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
34 %{?with_userspace:BuildRequires: linux-libc-headers >= 7:2.6.22.1-2}
35 BuildRequires: perl-base
36 BuildRequires: rpmbuild(macros) >= 1.379
37 Suggests: kernel-net-ipset
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41 IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which
42 can be administered by the ipset utility. Depending on the type,
43 currently an IP set may store IP addresses, (TCP/UDP) port numbers or
44 IP addresses with MAC addresses in a way, which ensures lightning
45 speed when matching an entry against a set.
47 %description -l pl.UTF-8
48 Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można
49 administrować przy użyciu narzędzia ipset. W zależności od rodzaju
50 aktualnie zbiór IP może przechowywać adresy IP, numery portów
51 (TCP/UDP) lub adresy IP z adresami MAC - w sposób zapewniający
52 maksymalną szybkość przy dopasowywaniu elementu do zbioru.
55 Summary: Header files for ipset interface
56 Summary(pl.UTF-8): Pliki nagłówkowe do interfejsu ipset
57 Group: Development/Libraries
60 Header files for IPset interface.
62 %description devel -l pl.UTF-8
63 Pliki nagłówkowe do interfejsu IPset.
66 Summary: IPset init script
67 Summary(pl.UTF-8): Skrypt startowy IPset
68 Group: Networking/Admin
69 Requires(post,preun): /sbin/chkconfig
70 Requires: %{pname} = %{version}-%{release}
74 IPset initialization script.
76 %description init -l pl.UTF-8
77 Skrypt startowy IPset.
79 %package -n kernel%{_alt_kernel}-net-ipset
80 Summary: IPset kernel modules
81 Summary(pl.UTF-8): Moduły jądra oferujące wsparcie dla zbiorów IP
82 Release: %{rel}@%{_kernel_ver_str}
84 %{?with_dist_kernel:%requires_releq_kernel}
85 Requires(post,postun): /sbin/depmod
87 %description -n kernel%{_alt_kernel}-net-ipset
88 IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which
89 can be administered by the ipset utility. Depending on the type,
90 currently an IP set may store IP addresses, (TCP/UDP) port numbers or
91 IP addresses with MAC addresses in a way, which ensures lightning
92 speed when matching an entry against a set.
94 This package contains kernel modules.
96 %description -n kernel%{_alt_kernel}-net-ipset -l pl.UTF-8
97 Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można
98 administrować przy użyciu narzędzia ipset. W zależności od rodzaju
99 aktualnie zbiór IP może przechowywać adresy IP, numery portów
100 (TCP/UDP) lub adresy IP z adresami MAC - w sposób zapewniający
101 maksymalną szybkość przy dopasowywaniu elementu do zbioru.
103 Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.
106 %setup -q -n %{pname}-%{version}
108 mv kernel/{Kbuild,Makefile}
110 # maximum number of ipsets.
111 %{__sed} -i 's:$(IP_NF_SET_MAX):256:' kernel/Makefile
112 # hash size for bindings of IP sets.
113 %{__sed} -i 's:$(IP_NF_SET_HASHSIZE):1024:' kernel/Makefile
114 # these options can be overriden by module parameters.
116 %if "%{cc_version}" < "3.4"
117 %{__sed} -i -e 's/-Wextra//' Makefile
118 %{__sed} -i -e 's/-Winit-self//' Makefile
119 %{__sed} -i -e 's/-Wold-style-definition//' Makefile
120 %{__sed} -i -e 's/-Wno-missing-field-initializers//' Makefile
124 %if %{with userspace}
127 PREFIX="%{_prefix}" \
128 LIBDIR="%{_libdir}" \
129 MANDIR="%{_mandir}" \
130 BINDIR="%{_sbindir}" \
131 COPT_FLAGS:="%{rpmcflags}"
135 # ugly hack for satisfy rpm build macro. in fact all modules will be build.
136 %build_kernel_modules -C kernel -m ip_set
140 rm -rf $RPM_BUILD_ROOT
142 %if %{with userspace}
143 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}}
145 %{__make} binaries_install \
146 DESTDIR="$RPM_BUILD_ROOT" \
147 PREFIX="%{_prefix}" \
148 LIBDIR="%{_libdir}" \
149 MANDIR="%{_mandir}" \
152 cp -a *.h $RPM_BUILD_ROOT%{_includedir}
153 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname}
158 %install_kernel_modules -m ip_set -d kernel/net/ipv4/netfilter
159 install -p ip_set_*.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter
160 install -p ipt_*.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter
165 rm -rf $RPM_BUILD_ROOT
168 /sbin/chkconfig --add %{pname}
171 if [ "$1" = "0" ]; then
172 /sbin/chkconfig --del %{pname}
175 %post -n kernel%{_alt_kernel}-net-ipset
176 %depmod %{_kernel_ver}
178 %postun -n kernel%{_alt_kernel}-net-ipset
179 %depmod %{_kernel_ver}
181 %if %{with userspace}
183 %defattr(644,root,root,755)
184 %doc ChangeLog ChangeLog.ippool TODO
185 %attr(755,root,root) %{_sbindir}/*
186 %dir %{_libdir}/ipset
187 %attr(755,root,root) %{_libdir}/ipset/*.so
191 %defattr(644,root,root,755)
195 %defattr(644,root,root,755)
196 %attr(754,root,root) /etc/rc.d/init.d/ipset
200 %files -n kernel%{_alt_kernel}-net-ipset
201 %defattr(644,root,root,755)
202 /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/*.ko*