-%package -n kernel%{_alt_kernel}-net-ipset
-Summary: IPset kernel modules
-Summary(pl.UTF-8): Moduły jądra oferujące wsparcie dla zbiorów IP
-Release: %{rel}@%{_kernel_ver_str}
-Group: Base/Kernel
-%{?with_dist_kernel:%requires_releq_kernel}
-Requires(post,postun): /sbin/depmod
-
-%description -n kernel%{_alt_kernel}-net-ipset
-IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which
-can be administered by the ipset utility. Depending on the type,
-currently an IP set may store IP addresses, (TCP/UDP) port numbers or
-IP addresses with MAC addresses in a way, which ensures lightning
-speed when matching an entry against a set.
-
-This package contains kernel modules.
-
-%description -n kernel%{_alt_kernel}-net-ipset -l pl.UTF-8
-Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można
-administrować przy użyciu narzędzia ipset. W zależności od
-rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery
-portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób
-zapewniający maksymalną szybkość przy dopasowywaniu elementu do
-zbioru.
-
-Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.
+%package -n bash-completion-ipset
+Summary: Bash completion for ipset command
+Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia ipset
+Group: Applications/Shells
+Requires: %{pname} = %{version}-%{release}
+Requires: bash-completion >= 2.0
+
+%description -n bash-completion-ipset
+Bash completion for ipset command.
+
+%description -n bash-completion-ipset -l pl.UTF-8
+Bashowe dopełnianie parametrów polecenia ipset.
+
+%define kernel_pkg()\
+%package -n kernel%{_alt_kernel}-net-ipset\
+Summary: IPset kernel modules\
+Summary(pl.UTF-8): Moduły jądra oferujące wsparcie dla zbiorów IP\
+Release: %{rel}@%{_kernel_ver_str}\
+Group: Base/Kernel\
+Requires(post,postun): /sbin/depmod\
+%requires_releq_kernel\
+Requires(postun): %releq_kernel\
+\
+%description -n kernel%{_alt_kernel}-net-ipset\
+IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which\
+can be administered by the ipset utility. Depending on the type,\
+currently an IP set may store IP addresses, (TCP/UDP) port numbers or\
+IP addresses with MAC addresses in a way, which ensures lightning\
+speed when matching an entry against a set.\
+\
+This package contains kernel modules.\
+\
+%description -n kernel%{_alt_kernel}-net-ipset -l pl.UTF-8\
+Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można\
+administrować przy użyciu narzędzia ipset. W zależności od\
+rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery\
+portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób\
+zapewniający maksymalną szybkość przy dopasowywaniu elementu do\
+zbioru.\
+\
+Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.\
+\
+%if %{with kernel}\
+%files -n kernel%{_alt_kernel}-net-ipset\
+%defattr(644,root,root,755)\
+/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/xt_*.ko*\
+%dir /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset\
+/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set.ko*\
+/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set_*.ko*\
+%endif\
+\
+%post -n kernel%{_alt_kernel}-net-ipset\
+%depmod %{_kernel_ver}\
+\
+%postun -n kernel%{_alt_kernel}-net-ipset\
+%depmod %{_kernel_ver}\
+%{nil}
+
+%define build_kernel_pkg()\
+%configure \\\
+ --disable-silent-rules \\\
+ --with-kmod=yes \\\
+ --with-kbuild=%{_kernelsrcdir} \\\
+ --with-settype-modules-list=all\
+\
+# a hack not to list all modules: list only ip_set, all other are build anyway\
+%build_kernel_modules -C kernel/net/netfilter -m ipset/ip_set IP_SET_MAX=255 KDIR=$PWD/../..\
+\
+for drv in kernel/net/netfilter/ipset/ip_set*.ko ; do\
+%install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter/ipset\
+done\
+for drv in kernel/net/netfilter/xt_*.ko ; do\
+%install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter\
+done\
+%{nil}
+
+%{?with_kernel:%{expand:%create_kernel_packages}}