Setting tag ipfw-20120610-1
[ipfw.git] / planetlab / ipfwroot.spec
1 #
2 # Marta Carbone <marta.carbone@iet.unipi.it>
3 # 2009 - Universita` di Pisa
4 # License is BSD.
5
6 #
7 # xxx: TODO restart crond
8 #
9
10 # kernel_release, kernel_version and kernel_arch are expected to be set by the build to e.g.
11 # kernel_release : 24.onelab  (24 is then the planetlab taglevel)
12 # kernel_version : 2.6.27.57 | 2.6.32  (57 in the 27 case is the patch level)
13 # kernel_arch :    i686 | x86_64
14
15 # this release was pulled from http://info.iet.unipi.it/~marta/dummynet/ipfw3-20120610.tar.gz
16 %define name ipfwroot
17 %define version 20120610
18 %define taglevel 1
19
20 # when no planetlab kernel is being built, kernel_version is defined but empty
21 %define _with_planetlab_kernel %{?kernel_version:1}%{!?kernel_version:0}
22 # we need to make sure that this rpm gets upgraded when the kernel release changes
23 %if %{_with_planetlab_kernel}
24 # with the planetlab kernel
25 %define pl_kernel_taglevel %( echo %{kernel_release} | cut -d. -f1 )
26 %define ipfw_release %{kernel_version}.%{pl_kernel_taglevel}
27 %else
28 # with the stock kernel
29 # this line below
30 #%define ipfw_release %( rpm -q --qf "%{version}" kernel-headers )
31 # causes recursive macro definition no matter how much you quote
32 %define percent %
33 %define braop \{
34 %define bracl \}
35 %define kernel_version %( rpm -q --qf %{percent}%{braop}version%{bracl} kernel-headers )
36 %define kernel_release %( rpm -q --qf %{percent}%{braop}release%{bracl} kernel-headers )
37 %define kernel_arch %( rpm -q --qf %{percent}%{braop}arch%{bracl} kernel-headers )
38 %define ipfw_release %{kernel_version}.%{kernel_release}
39 %endif
40
41 %define release %{ipfw_release}.%{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
42
43 # guess which convention is used; k27 and before used dash, k32 uses dot
44 %define kernelpath_dash /usr/src/kernels/%{kernel_version}-%{kernel_release}-%{kernel_arch}
45 %define kernelpath_dot /usr/src/kernels/%{kernel_version}-%{kernel_release}.%{kernel_arch}
46 %define kernelpath %( [ -d %{kernelpath_dot} ] && echo %{kernelpath_dot} || echo %{kernelpath_dash} )
47
48 # the k32 kernel currently builds e.g. /lib/modules/2.6.32-0.onelab.2010.12.07-i686
49 # the k27 and before does not have the -i686 part
50 %define kernel_id_old %{kernel_version}-%{kernel_release}
51 %define kernel_id_new %{kernel_version}-%{kernel_release}.%{kernel_arch}
52 %define kernel_id %( [ -d %{kernelpath_dot} ] && echo %{kernel_id_new} || echo %{kernel_id_old} )
53
54 Summary: ipfw and dummynet for Linux
55 Name: %{name}
56 Version: %{version}
57 Release: %{release}
58 License: BSD
59 Group: System Environment/Kernel
60 Source0: %{name}-%{version}.tar.bz2
61 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
62 Requires: vixie-cron
63 Requires: vsys-scripts
64 Obsoletes: ipfw
65
66 Vendor: unipi
67 Packager: PlanetLab <marta@onelab2.iet.unipi.it>
68 # XXX ask 
69 Distribution: PlanetLab %{plrelease}
70 URL: %{SCMURL}
71
72 %description
73 ipfw is the Linux port of the FreeBSD ipfw and dummynet packages
74
75 %prep
76 %setup
77
78 %build
79 # clean the rpm build directory
80 rm -rf $RPM_BUILD_ROOT
81
82 %__make KERNELPATH=%kernelpath clean
83 %__make KERNELPATH=%kernelpath IPFW_PLANETLAB=1
84
85 %install
86 install -D -m 755 dummynet2/ipfw_mod.ko $RPM_BUILD_ROOT/lib/modules/%{kernel_id}/net/netfilter/ipfw_mod.ko
87 install -D -m 755 ipfw/ipfw $RPM_BUILD_ROOT/sbin/ipfw
88 install -D -m 644 planetlab/ipfw.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/ipfw.cron
89 install -D -m 755 planetlab/ipfw $RPM_BUILD_ROOT/etc/rc.d/init.d/ipfw
90
91 %clean
92 rm -rf $RPM_BUILD_ROOT
93
94 %post
95 ### this script is also triggered while the node image is being created at build-time
96 # some parts of the script do not make sense in this context
97 # this is why the build exports PL_BOOTCD=1 in such cases
98 depmod -a
99 /sbin/chkconfig --add ipfw
100 # start the service if not building
101 [ -z "$PL_BOOTCD" ] && service ipfw start
102
103 %postun
104 # stop the service if not building
105 [ -z "$PL_BOOTCD" ] && service ipfw stop
106
107 # here there is a list of the final installation directories
108 %files
109 %defattr(-,root,root)
110 %dir /lib/modules/%{kernel_id}
111 /lib/modules/%{kernel_id}/net/netfilter/ipfw_mod.ko
112 /sbin/ipfw
113 %{_sysconfdir}/cron.d/ipfw.cron
114 /etc/rc.d/init.d/ipfw
115
116 %changelog
117 * Fri Jun 15 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-20120610-1
118 - integrated ipfw3 as of 20120610 from upstream
119
120 * Mon Oct 24 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-23
121 - for building against k32 on f8
122
123 * Sun Oct 02 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-22
124 - rpm version number has the kernel taglevel embedded
125
126 * Fri Jun 10 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-21
127 - build tweaks for gcc-4.6 on f15
128
129 * Sun Jan 23 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-20
130 - tweaks for compiling on k32/64 bits
131
132 * Wed Dec 08 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-19
133 - fix detection of kernel conventions
134
135 * Tue Dec 07 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-18
136 - guess conventions for either <=k27 or >=k32
137
138 * Tue Jun 15 2010 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - ipfw-0.9-17
139 - testing git only module-tag
140
141 * Tue Jun 15 2010 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - ipfw-0.9-16
142 - tagging ipfw to test module-tools on (pure) git
143
144 * Wed May 12 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - ipfw-0.9-15
145 - tagging for obsoletes
146
147 * Tue Apr 27 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-13
148 - Update to the ipfw3 version of the dummynet code.
149
150 * Mon Apr 12 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-11
151 - add ipfw initialization script to chkconfig
152
153 * Wed Mar 03 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - ipfw-0.9-10
154 - - Load module at installation - Marta
155
156 * Mon Jan 11 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-9
157 - consistent with vsys-scripts-0.95-13
158
159 * Mon Jan 11 2010 Marta Carbone <marta.carbone@iet.unipi.it>
160 - Integrated the ipfw rules cleanup into the backend
161
162 * Sat Jan 09 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-8
163 - builds on 2.6.22 & 2.6.27 - for 32 and 64 bits
164
165 * Wed Jan 06 2010 Marta Carbone <marta.carbone@iet.unipi.it>
166 - move to dummynet2, added support for table lookup
167 - added the vsys-script dependencies and the ipfw initialization
168
169 * Tue Dec 15 2009 Marta Carbone <marta.carbone@iet.unipi.it>
170 - more work on the radix code, added sysctl read/write support
171
172 * Sun Nov 29 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-7
173 - added missing qsort.c - tag 0.9-6 was broken
174
175 * Thu Nov 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-6
176 - root: removed goto into the main ipfw switch, enabled slice_id matching
177 - slice: completely move netconfig checks into the backend
178
179 * Mon Nov 09 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-5
180 - additional features on matching packets, including uid match
181
182 * Mon Sep 07 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-4
183 - on behalf of Marta Carbone, more options and features
184
185 * Thu Jul 23 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-3
186 - fixed memory usage issue
187
188 * Wed Jul 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - ipfw-0.9-2
189 - patch for building on x86_64
190
191 * Thu Jun 25 2009 Marta Carbone <marta.carbone@iet.unipi.it>
192 - post installation removed for deployment, moved manpages to the slice package
193
194 * Fri Apr 17 2009 Marta Carbone <marta.carbone@iet.unipi.it>
195 - Initial release