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