Summary: Tools for managing Linux kernel packet filtering capabilities.
Name: ipchains
Version: 1.3.10
Release: 1%{?_dist_release}
License: GPL
Obsoletes: ipfwadm ipchains-scripts
Group: System Environment/Base
Source0: http://netfilter.filewatcher.org/ipchains/ipchains-%{version}.tar.gz
Source1: http://netfilter.filewatcher.org/ipchains/ipchains-scripts-1.1.2.tar.gz
Source2: http://netfilter.filewatcher.org/ipchains/HOWTO.sgml
Source3: ipchains.init
Patch0: ipchains-1.3.10-nonroot.patch
Patch1: ipchains-1.3.10-fixman.patch
Patch2: ipchains-1.3.9-return.patch
Patch3: ipchains-1.3.10-libipfwc.patch
Buildroot: %{_tmppath}/%{name}-root
Prereq: /sbin/chkconfig
BuildPrereq: perl, sgml-tools
Requires: sh-utils

%description 
Linux IP Firewalling Chains is an update to (and hopefully an
improvement upon) the Linux kernel packet filtering code. Ipchains
allows you to set up firewalls and IP masquerading, etc.

Install ipchains if you need to set up firewalling for your network.

%prep
%setup -q -a 1
%patch0 -p1 -b .nonroot
%patch1 -p1 -b .fixman
%patch2 -p1 -b .return
%patch3 -p0 -b .libipfwc
install -m644 %{SOURCE2} .

%build
make clean
make COPTS="$RPM_OPT_FLAGS"
sgml2html HOWTO.sgml
sgml2txt HOWTO.sgml
%{__perl} -pi -e 's/.//g' HOWTO.txt

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/{sbin,%{_mandir}/man{4,8}}

make install SBIN=%{buildroot}/sbin MANDIR=%{buildroot}/%{_mandir}
cp ipchains-scripts-1.1.2/{ipchains-restore,ipchains-save} %{buildroot}/sbin
cp ipchains-scripts-1.1.2/ipfwadm-wrapper %{buildroot}/sbin/ipfwadm
ln -sf ipfwadm %{buildroot}/sbin/ipfwadm-wrapper
cp ipchains-scripts-1.1.2/{ipchains-restore.8,ipchains-save.8,ipfwadm-wrapper.8} %{buildroot}/%{_mandir}/man8

install -d -m 755 %{buildroot}/etc/rc.d/init.d
install -m 755 %{SOURCE3} %{buildroot}/etc/rc.d/init.d/ipchains

strip %{buildroot}/sbin/ipchains

%clean
rm -rf %{buildroot}

%post
#/sbin/chkconfig --add ipchains

%preun
if [ $1 = 0 ] ; then
	/sbin/chkconfig --del ipchains
fi

%files
%defattr(-,root,root)
%doc *.html *.sgml *.txt
%doc COPYING README ipchains-quickref.ps
%attr(755,root,root) %config /etc/rc.d/init.d/ipchains
/sbin/*
%{_mandir}/man*/*

%changelog
* Sun Sep 07 2008 Shu KONNO <owa@bg.wakwak.com> 1.3.10-1vl5
- applied new versioning policy
- added ipchains-1.3.10-libipfwc.patch

* Sun Sep 22 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.10-0vl3
- do not chkconfig --add in the %%post section
  (kernel >= 2.4 and iptables would be default for Vine)

* Sat Mar 02 2002 Toru Sagami <sagami@vinelinux.org> 1.3.10-0vl2
- use ipchains.init with i18n support (packed in 1.3.10-8)

* Thu Aug 16 2001 <sagami@vinelinux.org>
- 1.3.10-0vl1: sources/patches/spec are taken from 1.3.10-8
- rewrite ipchains.init w/o i18n support

* Wed Feb 16 2000 Cristian Gafton <gafton@redhat.com>
- fix stupid typo in the preun script

* Tue Feb 01 2000 Cristian Gafton <gafton@redhat.com>
- add the initscript from joshua
- remove uselss define version
- add %post and %preun

* Mon Sep 20 1999 Bill Nottingham <notting@redhat.com>
- strip binary

* Mon Aug 23 1999 Jeff Johnson <jbj@redhat.com>
- nuke backspaces in HOWTO.txt (#4249).

* Mon May 31 1999 Jeff Johnson <jbj@redhat.com>
- update to 1.3.9.

* Tue May 25 1999 Michael K. Johnson <johnsonm@redhat.com>
- new ipchains-scripts release 1.1.2
- ipfwadm-wrapper should be called ipfwadm with symlink to old name
  (users can install old ipfwadm as ipfwadm.real if they wish)

* Tue Mar 23 1999 Bill Nottingham <notting@redhat.com>
- obsolete phantom ipchains-scripts package that's been floating around...

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 2)

* Tue Nov 17 1998 Preston Brown <pbrown@redhat.com>
- initial cut.
