Tagging module iptables - iptables-1.4.1.1-1
[iptables.git] / iptables.spec
1 #
2 # $Id: iproute.spec 7668 2008-01-08 11:49:43Z thierry $
3 #
4 %define url $URL: svn+ssh://thierry@svn.planet-lab.org/svn/iproute2/trunk/iproute.spec $
5
6 %define name iptables
7 %define version 1.4.1.1
8 %define taglevel 1
9
10 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
11
12 Vendor: PlanetLab
13 Packager: PlanetLab Central <support@planet-lab.org>
14 Distribution: PlanetLab %{plrelease}
15 URL: %(echo %{url} | cut -d ' ' -f 2)
16
17 %define build_devel 1
18 %define linux_header 0
19
20 Summary: Tools for managing Linux kernel packet filtering capabilities.
21 Name: %{name}
22 Version: %{version}
23 Release: %{release}
24 Source: http://www.netfilter.org/%{name}-%{version}.tar.bz2
25 %define SOURCE1 iptables.init
26 %define SOURCE2 iptables-config
27 %define SOURCE3 planetlab-config
28 Group: System Environment/Base
29 #URL: http://www.netfilter.org/
30 BuildRoot: %{_tmppath}/%{name}-buildroot
31 License: GPL
32 BuildPrereq: /usr/bin/perl
33 Requires: kernel >= 2.6.27
34 Requires(post,postun): chkconfig
35 Prefix: %{_prefix}
36 BuildRequires: kernel-devel
37
38 %package ipv6
39 Summary: IPv6 support for iptables.
40 Group: System Environment/Base
41 Requires: %{name} = %{version}
42
43 %if %{build_devel}
44 %package devel
45 Summary: Development package for iptables.
46 Group: System Environment/Base
47 Requires: %{name} = %{version}
48 %endif
49
50 %description
51 The iptables utility controls the network packet filtering code in the
52 Linux kernel. If you need to set up firewalls and/or IP masquerading,
53 you should install this package.
54
55 %description ipv6
56 The iptables package contains IPv6 (the next version of the IP
57 protocol) support for iptables. Iptables controls the Linux kernel
58 network packet filtering code, allowing you to set up firewalls and IP
59 masquerading. 
60
61 Install iptables-ipv6 if you need to set up firewalling for your
62 network and you are using ipv6.
63
64 %if %{build_devel}
65 %description devel
66 The iptables utility controls the network packet filtering code in the
67 Linux kernel. If you need to set up firewalls and/or IP masquerading,
68 you should install this package.
69 %endif
70
71 %prep
72 rm -rf %{buildroot}
73
74 %setup -q
75
76 # Put it to a reasonable place
77 find . -type f -exec perl -pi -e "s,/usr,%{prefix},g" {} \;
78
79 %build
80 TOPDIR=`pwd`
81 OPT="$RPM_OPT_FLAGS -I$TOPDIR/include"
82
83 %define KERNEL %(rpm -q --qf '%%{VERSION}-%%{RELEASE}-%%{ARCH}\\n' kernel-devel | tail -n 1 )
84 count=$(rpm -q kernel-devel| wc -l)
85 if [ $count -gt 1 ] ; then
86         echo "WARNING: choosing kernel-devel-%{KERNEL}"
87         echo "  but there are other kernel-devel packages installed: $(rpm -q kernel-devel)"
88 fi
89         
90 %define KERNEL_DIR "/usr/src/kernels/%{KERNEL}"
91
92 %if %{build_devel}
93 %define configure_option --enable-devel
94 %else
95 %define configure_option
96 %endif
97
98 ./configure --prefix=/usr %{configure_option} --enable-libipq --bindir=/bin --sbindir=/sbin --sysconfdir=/etc --libdir=/%{_libdir} --libexecdir=/%{_lib} --mandir=%{_mandir} --includedir=%{_includedir}
99
100 make COPT_FLAGS="$OPT" KERNEL_DIR=%{KERNEL_DIR} LIBDIR=/%{_lib}
101
102 %install
103 # Thierry : for 1.4.1.1
104 # from http://fr2.rpmfind.net/linux/fedora/releases/10/Everything/source/SRPMS/iptables-1.4.1.1-2.fc10.src.rpm
105 make install DESTDIR=%{buildroot} 
106
107 # install iptc devel library
108 %if %{build_devel}
109 install -m 644 libiptc/libiptc.a %{buildroot}/%{_libdir}
110 %endif
111
112 # install init scripts and configuration files
113 install -d -m 755 $RPM_BUILD_ROOT/etc/rc.d/init.d
114 install -c -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/iptables
115 sed -e 's;iptables;ip6tables;g' -e 's;IPTABLES;IP6TABLES;g' < %{SOURCE1} > ip6tables.init
116 install -c -m 755 ip6tables.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ip6tables
117 install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
118 install -c -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/iptables-config
119 sed -e 's;iptables;ip6tables;g' -e 's;IPTABLES;IP6TABLES;g' < %{SOURCE2} > ip6tables-config
120 install -c -m 755 ip6tables-config $RPM_BUILD_ROOT/etc/sysconfig/ip6tables-config
121 install -c -m755 %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/iptables
122
123 %clean
124 rm -rf $RPM_BUILD_ROOT 
125
126 %post
127 /sbin/chkconfig --add iptables
128 if [ "$PL_BOOTCD" != "1" ] ; then
129     /sbin/service iptables restart
130 fi
131
132 %preun
133 if [ "$1" = 0 ]; then
134     /sbin/chkconfig --del iptables
135 fi
136
137 %post ipv6
138 /sbin/chkconfig --add ip6tables
139 if [ "$PL_BOOTCD" != "1" ] ; then
140     /sbin/service ip6tables restart
141 fi
142
143 %preun ipv6
144 if [ "$1" = 0 ]; then
145     /sbin/chkconfig --del ip6tables
146 fi
147
148 %files
149 %defattr(-,root,root,0755)
150 %doc COPYING INSTALL INCOMPATIBILITIES
151 %config %attr(0755,root,root) /etc/rc.d/init.d/iptables
152 %config(noreplace) %attr(0600,root,root) /etc/sysconfig/iptables-config
153 %config(noreplace) %attr(0600,root,root) /etc/sysconfig/iptables
154 /sbin/iptables*
155 %{_mandir}/man8/iptables*
156
157 # Thierry - WARNING : location changed
158 %dir /%{_lib}/xtables
159 # WARNING : location changed
160 /%{_lib}/xtables/libipt*
161 # WARNING : new stuff
162 /%{_lib}/xtables/libxt*
163 # WARNING : not found at all
164 #/sbin/ipset*
165 #%{_mandir}/man8/ipset*
166 #%dir /%{_lib}/ipset
167 #/%{_lib}/ipset/libipset*
168
169 %files ipv6
170 %defattr(-,root,root,0755)
171 %config %attr(0755,root,root) /etc/rc.d/init.d/ip6tables
172 %config(noreplace) %attr(0600,root,root) /etc/sysconfig/ip6tables-config
173 /sbin/ip6tables*
174 # Thierry - WARNING : new stuff
175 /bin/iptables-xml
176 %{_mandir}/man8/ip6tables*
177 # WARNING : location changed
178 /%{_lib}/xtables/libip6t*
179
180 %if %{build_devel}
181 %files devel
182 %defattr(-,root,root,0755)
183 %{_includedir}/*.h
184 %dir %{_includedir}/libiptc
185 %{_includedir}/libiptc/*.h
186 %{_libdir}/libipq.a
187 %{_libdir}/libiptc.a
188 %{_mandir}/man3/*
189 %endif
190
191 %changelog
192 * Sun May 31 2009 Sapan Bhatia <sapanb@cs.princeton.edu> - iptables-1.4.1.1-1
193
194 * Sun Feb 22 2009 Sapan Bhatia <sapanb@cs.princeton.edu>
195 - Checking in initial version of iptables 1.4.1.1