rhel: Add systemd suport for ovn-controller-vtep.
[cascardo/ovs.git] / rhel / openvswitch-fedora.spec.in
1 # Spec file for Open vSwitch.
2
3 # Copyright (C) 2009, 2010, 2013, 2014, 2015 Nicira Networks, Inc.
4 #
5 # Copying and distribution of this file, with or without modification,
6 # are permitted in any medium without royalty provided the copyright
7 # notice and this notice are preserved.  This file is offered as-is,
8 # without warranty of any kind.
9 #
10 # If tests have to be skipped while building, specify the '--without check'
11 # option. For example:
12 # rpmbuild -bb --without check rhel/openvswitch-fedora.spec
13
14 #%define kernel 2.6.40.4-5.fc15.x86_64
15
16 # Enable PIE, bz#955181
17 %global _hardened_build 1
18
19 # some distros (e.g: RHEL-7) don't define _rundir macro yet
20 # Fedora 15 onwards uses /run as _rundir
21 %if 0%{!?_rundir:1}
22 %define _rundir /run
23 %endif
24
25 Name: openvswitch
26 Summary: Open vSwitch
27 Group: System Environment/Daemons
28 URL: http://www.openvswitch.org/
29 Version: @VERSION@
30
31 # Nearly all of openvswitch is ASL 2.0.  The bugtool is LGPLv2+, and the
32 # lib/sflow*.[ch] files are SISSL
33 # datapath/ is GPLv2 (although not built into any of the binary packages)
34 License: ASL 2.0 and LGPLv2+ and SISSL
35 Release: 1%{?dist}
36 Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
37
38 BuildRequires: autoconf automake libtool
39 BuildRequires: systemd-units openssl openssl-devel
40 BuildRequires: python python-twisted-core python-zope-interface PyQt4
41 BuildRequires: desktop-file-utils
42 BuildRequires: groff graphviz
43 # make check dependencies
44 BuildRequires: procps-ng
45
46 Requires: openssl iproute module-init-tools
47 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
48 #Requires: kernel >= 3.15.0-0
49
50 Requires(post): systemd-units
51 Requires(preun): systemd-units
52 Requires(postun): systemd-units
53 Obsoletes: openvswitch-controller <= 0:2.1.0-1
54
55 %bcond_without check
56
57 %description
58 Open vSwitch provides standard network bridging functions and
59 support for the OpenFlow protocol for remote per-flow control of
60 traffic.
61
62 %package -n python-openvswitch
63 Summary: Open vSwitch python bindings
64 License: ASL 2.0
65 BuildArch: noarch
66 Requires: python
67
68 %description -n python-openvswitch
69 Python bindings for the Open vSwitch database
70
71 %package test
72 Summary: Open vSwitch testing utilities
73 License: ASL 2.0
74 BuildArch: noarch
75 Requires: python-openvswitch = %{version}-%{release}
76 Requires: python python-twisted-core python-twisted-web
77
78 %description test
79 Utilities that are useful to diagnose performance and connectivity
80 issues in Open vSwitch setup.
81
82 %package devel
83 Summary: Open vSwitch OpenFlow development package (library, headers)
84 License: ASL 2.0
85 Provides: openvswitch-static = %{version}-%{release}
86
87 %description devel
88 This provides static library, libopenswitch.a and the openvswitch header
89 files needed to build an external application.
90
91 %package ovn
92 Summary: Open vSwitch - Open Virtual Network support
93 License: ASL 2.0
94 Requires: openvswitch
95
96 %description ovn
97 OVN, the Open Virtual Network, is a system to support virtual network
98 abstraction.  OVN complements the existing capabilities of OVS to add
99 native support for virtual network abstractions, such as virtual L2 and L3
100 overlays and security groups.
101
102
103 %prep
104 %setup -q
105
106 %build
107 %configure --enable-ssl --with-pkidir=%{_sharedstatedir}/openvswitch/pki
108 make %{?_smp_mflags}
109
110 %install
111 rm -rf $RPM_BUILD_ROOT
112 make install DESTDIR=$RPM_BUILD_ROOT
113
114 install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
115
116 install -p -D -m 0644 \
117         rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
118         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
119 for service in openvswitch openvswitch-nonetwork \
120                 ovn-controller ovn-controller-vtep ovn-northd; do
121         install -p -D -m 0644 \
122                         rhel/usr_lib_systemd_system_${service}.service \
123                         $RPM_BUILD_ROOT%{_unitdir}/${service}.service
124 done
125 install -m 0755 rhel/etc_init.d_openvswitch \
126         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
127
128 install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \
129         $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
130
131 install -m 0644 vswitchd/vswitch.ovsschema \
132         $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
133
134 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
135 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
136         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
137 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
138         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
139
140 install -d -m 0755 $RPM_BUILD_ROOT%{python_sitelib}
141 mv $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
142    $RPM_BUILD_ROOT%{python_sitelib}
143 rmdir $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
144
145 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
146
147 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
148 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
149
150 %check
151 %if %{with check}
152     if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
153        make check TESTSUITEFLAGS='--recheck'; then :;
154     else
155         cat tests/testsuite.log
156         exit 1
157     fi
158 %endif
159
160 %clean
161 rm -rf $RPM_BUILD_ROOT
162
163 %preun
164 %if 0%{?systemd_preun:1}
165     %systemd_preun %{name}.service
166 %else
167     if [ $1 -eq 0 ] ; then
168     # Package removal, not upgrade
169         /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
170         /bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
171     fi
172 %endif
173
174 %preun ovn
175 %if 0%{?systemd_preun:1}
176     %systemd_preun ovn-controller.service
177     %systemd_preun ovn-controller-vtep.service
178     %systemd_preun ovn-northd.service
179 %else
180     if [ $1 -eq 0 ] ; then
181     # Package removal, not upgrade
182         /bin/systemctl --no-reload disable ovn-controller.service >/dev/null 2>&1 || :
183         /bin/systemctl stop ovn-controller.service >/dev/null 2>&1 || :
184         /bin/systemctl --no-reload disable ovn-controller-vtep.service >/dev/null 2>&1 || :
185         /bin/systemctl stop ovn-controller-vtep.service >/dev/null 2>&1 || :
186         /bin/systemctl --no-reload disable ovn-northd.service >/dev/null 2>&1 || :
187         /bin/systemctl stop ovn-northd.service >/dev/null 2>&1 || :
188     fi
189 %endif
190
191 %post
192 %if 0%{?systemd_post:1}
193     %systemd_post %{name}.service
194 %else
195     # Package install, not upgrade
196     if [ $1 -eq 1 ]; then
197         /bin/systemctl daemon-reload >dev/null || :
198     fi
199 %endif
200
201 %post ovn
202 %if 0%{?systemd_post:1}
203     %systemd_post ovn-controller.service
204     %systemd_post ovn-controller-vtep.service
205     %systemd_post ovn-northd.service
206 %else
207     # Package install, not upgrade
208     if [ $1 -eq 1 ]; then
209         /bin/systemctl daemon-reload >dev/null || :
210     fi
211 %endif
212
213 %postun
214 %if 0%{?systemd_postun_with_restart:1}
215     %systemd_postun_with_restart %{name}.service
216 %else
217     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
218     if [ "$1" -ge "1" ] ; then
219     # Package upgrade, not uninstall
220         /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
221     fi
222 %endif
223
224 %postun ovn
225 %if 0%{?systemd_postun_with_restart:1}
226     %systemd_postun_with_restart ovn-controller.service
227     %systemd_postun_with_restart ovn-controller-vtep.service
228     %systemd_postun_with_restart ovn-northd.service
229 %else
230     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
231     if [ "$1" -ge "1" ] ; then
232     # Package upgrade, not uninstall
233         /bin/systemctl try-restart ovn-controller.service >/dev/null 2>&1 || :
234         /bin/systemctl try-restart ovn-controller-vtep.service >/dev/null 2>&1 || :
235         /bin/systemctl try-restart ovn-northd.service >/dev/null 2>&1 || :
236     fi
237 %endif
238
239 %files -n python-openvswitch
240 %{python_sitelib}/ovs
241 %doc COPYING
242
243 %files test
244 %{_bindir}/ovs-test
245 %{_bindir}/ovs-vlan-test
246 %{_bindir}/ovs-l3ping
247 %{_mandir}/man8/ovs-test.8*
248 %{_mandir}/man8/ovs-vlan-test.8*
249 %{_mandir}/man8/ovs-l3ping.8*
250 %{python_sitelib}/ovstest
251
252 %files devel
253 %{_libdir}/*.a
254 %{_libdir}/*.la
255 %{_libdir}/pkgconfig/*.pc
256 %{_includedir}/openvswitch/*
257 %{_includedir}/openflow/*
258
259 %files
260 %defattr(-,root,root)
261 %{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash
262 %{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash
263 %dir %{_sysconfdir}/openvswitch
264 %config %ghost %{_sysconfdir}/openvswitch/conf.db
265 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
266 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
267 %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
268 %{_unitdir}/openvswitch.service
269 %{_unitdir}/openvswitch-nonetwork.service
270 %{_datadir}/openvswitch/scripts/openvswitch.init
271 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
272 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
273 %{_datadir}/openvswitch/bugtool-plugins/
274 %{_datadir}/openvswitch/scripts/ovs-bugtool-*
275 %{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
276 %{_datadir}/openvswitch/scripts/ovs-lib
277 %{_datadir}/openvswitch/scripts/ovs-vtep
278 %{_datadir}/openvswitch/scripts/ovs-ctl
279 %config %{_datadir}/openvswitch/vswitch.ovsschema
280 %config %{_datadir}/openvswitch/vtep.ovsschema
281 %{_bindir}/ovs-appctl
282 %{_bindir}/ovs-docker
283 %{_bindir}/ovs-dpctl
284 %{_bindir}/ovs-dpctl-top
285 %{_bindir}/ovs-ofctl
286 %{_bindir}/ovs-vsctl
287 %{_bindir}/ovsdb-client
288 %{_bindir}/ovsdb-tool
289 %{_bindir}/ovs-testcontroller
290 %{_bindir}/ovs-pki
291 %{_bindir}/vtep-ctl
292 %{_sbindir}/ovs-bugtool
293 %{_sbindir}/ovs-vswitchd
294 %{_sbindir}/ovsdb-server
295 %{_mandir}/man1/ovs-benchmark.1*
296 %{_mandir}/man1/ovs-pcap.1*
297 %{_mandir}/man1/ovs-tcpundump.1*
298 %{_mandir}/man1/ovsdb-client.1*
299 %{_mandir}/man1/ovsdb-server.1*
300 %{_mandir}/man1/ovsdb-tool.1*
301 %{_mandir}/man5/ovs-vswitchd.conf.db.5*
302 %{_mandir}/man5/vtep.5*
303 %{_mandir}/man8/vtep-ctl.8*
304 %{_mandir}/man8/ovs-appctl.8*
305 %{_mandir}/man8/ovs-bugtool.8*
306 %{_mandir}/man8/ovs-ctl.8*
307 %{_mandir}/man8/ovs-dpctl.8*
308 %{_mandir}/man8/ovs-dpctl-top.8*
309 %{_mandir}/man8/ovs-ofctl.8*
310 %{_mandir}/man8/ovs-pki.8*
311 %{_mandir}/man8/ovs-vsctl.8*
312 %{_mandir}/man8/ovs-vswitchd.8*
313 %{_mandir}/man8/ovs-parse-backtrace.8*
314 %{_mandir}/man8/ovs-testcontroller.8*
315 %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md
316 %doc FAQ.md NEWS INSTALL.DPDK.md rhel/README.RHEL
317 /var/lib/openvswitch
318 /var/log/openvswitch
319 %ghost %attr(755,root,root) %{_rundir}/openvswitch
320 %exclude %{_bindir}/ovs-benchmark
321 %exclude %{_bindir}/ovs-parse-backtrace
322 %exclude %{_bindir}/ovs-pcap
323 %exclude %{_bindir}/ovs-tcpundump
324 %exclude %{_sbindir}/ovs-vlan-bug-workaround
325 %exclude %{_mandir}/man1/ovs-benchmark.1.gz
326 %exclude %{_mandir}/man1/ovs-pcap.1.gz
327 %exclude %{_mandir}/man1/ovs-tcpundump.1.gz
328 %exclude %{_mandir}/man8/ovs-vlan-bug-workaround.8.gz
329 %exclude %{_datadir}/openvswitch/scripts/ovs-save
330
331 %files ovn
332 %{_bindir}/ovn-controller
333 %{_bindir}/ovn-controller-vtep
334 %{_bindir}/ovn-nbctl
335 %{_bindir}/ovn-northd
336 %{_bindir}/ovn-sbctl
337 %{_datadir}/openvswitch/scripts/ovn-ctl
338 %{_mandir}/man8/ovs-testcontroller.8*
339 %{_mandir}/man5/ovn-nb.5*
340 %{_mandir}/man5/ovn-sb.5*
341 %{_mandir}/man7/ovn-architecture.7*
342 %{_mandir}/man8/ovn-controller.8*
343 %{_mandir}/man8/ovn-controller-vtep.8*
344 %{_mandir}/man8/ovn-ctl.8*
345 %{_mandir}/man8/ovn-nbctl.8*
346 %{_mandir}/man8/ovn-northd.8*
347 %{_mandir}/man8/ovn-sbctl.8*
348 %config %{_datadir}/openvswitch/ovn-nb.ovsschema
349 %config %{_datadir}/openvswitch/ovn-sb.ovsschema
350 %{_unitdir}/ovn-controller.service
351 %{_unitdir}/ovn-controller-vtep.service
352 %{_unitdir}/ovn-northd.service
353
354 %changelog
355 * Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>
356 - First build on F14