]> git.proxmox.com Git - mirror_ovs.git/blob - rhel/openvswitch.spec.in
rhel: start ovn-controller-vtep with ovn-ctl
[mirror_ovs.git] / rhel / openvswitch.spec.in
1 # Spec file for Open vSwitch on Red Hat Enterprise Linux.
2
3 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, 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.spec
13 #
14 # Support for executing kernel data path tests under rpmbuild is
15 # provided, however this is intended for use only in test environments
16 # and should not be used otherwise (these tests require root privileges).
17 # These tests can be executed, for example, via:
18 # rpmbuild -rb --with check_datapath_kernel openvswitch.src.rpm
19 #
20 # These tests will use the currently installed OVS kernel modules, when
21 # testing out of tree kernel modules the appropriate openvswitch-kmod
22 # package should be installed first.
23
24 Name: openvswitch
25 Summary: Open vSwitch daemon/database/utilities
26 Group: System Environment/Daemons
27 URL: http://www.openvswitch.org/
28 Vendor: Nicira, Inc.
29 Version: @VERSION@
30
31 License: ASL 2.0
32 Release: 1
33 Source: openvswitch-%{version}.tar.gz
34 Buildroot: /tmp/openvswitch-rpm
35 Requires: logrotate, hostname, python >= 2.7, python-six
36 BuildRequires: python-six
37 BuildRequires: openssl-devel
38 BuildRequires: checkpolicy, selinux-policy-devel
39 BuildRequires: autoconf, automake, libtool
40 BuildRequires: python-sphinx
41 BuildRequires: unbound-devel
42
43 %bcond_without check
44 %bcond_with check_datapath_kernel
45
46 %description
47 Open vSwitch provides standard network bridging functions and
48 support for the OpenFlow protocol for remote per-flow control of
49 traffic.
50
51 %package devel
52 Summary: Open vSwitch development package
53 Group: Development/Libraries
54
55 %description devel
56 This package provides openvswitch headers and libopenvswitch for developers.
57
58 %package selinux-policy
59 Summary: Open vSwitch SELinux policy
60 License: ASL 2.0
61 BuildArch: noarch
62 Requires: selinux-policy-targeted
63
64 %description selinux-policy
65 Tailored Open vSwitch SELinux policy
66
67 %prep
68 %setup -q
69
70 %build
71 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \
72 --libdir=%{_libdir} --enable-ssl --enable-shared
73 make %{_smp_mflags}
74 make selinux-policy
75
76 %install
77 rm -rf $RPM_BUILD_ROOT
78 make install DESTDIR=$RPM_BUILD_ROOT
79
80 rhel_cp() {
81 base=$1
82 mode=$2
83 dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g')
84 install -D -m $mode rhel/$base $dst
85 }
86 rhel_cp etc_init.d_openvswitch 0755
87 rhel_cp etc_logrotate.d_openvswitch 0644
88 rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755
89 rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755
90 rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644
91
92 install -p -m 644 -D selinux/openvswitch-custom.pp \
93 $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
94
95 # Get rid of stuff we don't want to make RPM happy.
96 rm \
97 $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \
98 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \
99 $RPM_BUILD_ROOT/usr/bin/ovs-test \
100 $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
101 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \
102 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
103 $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \
104 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 \
105 $RPM_BUILD_ROOT/usr/bin/ovn-* \
106 $RPM_BUILD_ROOT/usr/share/man/man?/ovn-* \
107 $RPM_BUILD_ROOT/usr/share/openvswitch/ovn-* \
108 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn*
109 (cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la)
110 (cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
111
112 install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
113 install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
114 install -d -m 0755 $RPM_BUILD_ROOT/var/lib/openvswitch
115
116 copy_headers() {
117 src=$1
118 dst=$RPM_BUILD_ROOT/$2
119 install -d -m 0755 $dst
120 install -m 0644 $src/*.h $dst
121 }
122 copy_headers include %{_includedir}/openvswitch
123 copy_headers include/openflow %{_includedir}/openvswitch/openflow
124 copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch
125 copy_headers include/sparse %{_includedir}/openvswitch/sparse
126 copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa
127 copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet
128 copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys
129 copy_headers lib %{_includedir}/openvswitch/lib
130
131 install -D -m 0644 lib/.libs/libopenvswitch.a \
132 $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
133
134 %check
135 %if %{with check}
136 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
137 else
138 cat tests/testsuite.log
139 exit 1
140 fi
141 %endif
142 %if %{with check_datapath_kernel}
143 if make check-kernel RECHECK=yes; then :;
144 else
145 cat tests/system-kmod-testsuite.log
146 exit 1
147 fi
148 %endif
149
150 %clean
151 rm -rf $RPM_BUILD_ROOT
152
153 %post
154 # Create default or update existing /etc/sysconfig/openvswitch.
155 SYSCONFIG=/etc/sysconfig/openvswitch
156 TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
157 if [ ! -e $SYSCONFIG ]; then
158 cp $TEMPLATE $SYSCONFIG
159 else
160 for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
161 do
162 if ! grep $var $SYSCONFIG >/dev/null 2>&1; then
163 echo >> $SYSCONFIG
164 sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG
165 fi
166 done
167 fi
168
169 # Ensure all required services are set to run
170 /sbin/chkconfig --add openvswitch
171 /sbin/chkconfig openvswitch on
172
173 %pre selinux-policy
174 %selinux_relabel_pre -s targeted
175
176 %post selinux-policy
177 %selinux_modules_install -s targeted %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
178
179 %preun
180 if [ "$1" = "0" ]; then # $1 = 0 for uninstall
181 /sbin/service openvswitch stop
182 /sbin/chkconfig --del openvswitch
183 fi
184
185 %postun
186 if [ "$1" = "0" ]; then # $1 = 0 for uninstall
187 rm -f /etc/openvswitch/conf.db
188 rm -f /etc/sysconfig/openvswitch
189 rm -f /etc/openvswitch/vswitchd.cacert
190 fi
191
192 %postun selinux-policy
193 if [ $1 -eq 0 ] ; then
194 %selinux_modules_uninstall -s targeted openvswitch-custom
195 fi
196
197 exit 0
198
199 %posttrans selinux-policy
200 %selinux_relabel_post -s targeted
201
202 %files
203 %defattr(-,root,root)
204 %dir /etc/openvswitch
205 /etc/bash_completion.d/ovs-appctl-bashcomp.bash
206 /etc/bash_completion.d/ovs-vsctl-bashcomp.bash
207 /etc/init.d/openvswitch
208 %config(noreplace) /etc/logrotate.d/openvswitch
209 /etc/sysconfig/network-scripts/ifup-ovs
210 /etc/sysconfig/network-scripts/ifdown-ovs
211 /usr/bin/ovs-appctl
212 /usr/bin/ovs-dpctl
213 /usr/bin/ovs-dpctl-top
214 /usr/bin/ovs-docker
215 /usr/bin/ovs-ofctl
216 /usr/bin/ovs-parse-backtrace
217 /usr/bin/ovs-pcap
218 /usr/bin/ovs-pki
219 /usr/bin/ovs-tcpdump
220 /usr/bin/ovs-tcpundump
221 /usr/bin/ovs-vlan-test
222 /usr/bin/ovs-vsctl
223 /usr/bin/ovsdb-client
224 /usr/bin/ovsdb-tool
225 /usr/bin/vtep-ctl
226 %{_libdir}/lib*.so.*
227 /usr/sbin/ovs-bugtool
228 /usr/sbin/ovs-vswitchd
229 /usr/sbin/ovsdb-server
230 /usr/share/man/man1/ovs-pcap.1.gz
231 /usr/share/man/man1/ovs-tcpundump.1.gz
232 /usr/share/man/man1/ovsdb-client.1.gz
233 /usr/share/man/man1/ovsdb-server.1.gz
234 /usr/share/man/man1/ovsdb-tool.1.gz
235 /usr/share/man/man5/ovsdb-server.5.gz
236 /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
237 %{_mandir}/man5/ovsdb.5*
238 /usr/share/man/man5/vtep.5.gz
239 /usr/share/man/man7/ovs-actions.7.gz
240 /usr/share/man/man7/ovs-fields.7.gz
241 %{_mandir}/man7/ovsdb.7*
242 %{_mandir}/man7/ovsdb-server.7*
243 /usr/share/man/man8/ovs-appctl.8.gz
244 /usr/share/man/man8/ovs-bugtool.8.gz
245 /usr/share/man/man8/ovs-ctl.8.gz
246 /usr/share/man/man8/ovs-dpctl.8.gz
247 /usr/share/man/man8/ovs-dpctl-top.8.gz
248 /usr/share/man/man8/ovs-kmod-ctl.8.gz
249 /usr/share/man/man8/ovs-ofctl.8.gz
250 /usr/share/man/man8/ovs-parse-backtrace.8.gz
251 /usr/share/man/man8/ovs-pki.8.gz
252 /usr/share/man/man8/ovs-tcpdump.8.gz
253 /usr/share/man/man8/ovs-vlan-test.8.gz
254 /usr/share/man/man8/ovs-vsctl.8.gz
255 /usr/share/man/man8/ovs-vswitchd.8.gz
256 /usr/share/man/man8/vtep-ctl.8.gz
257 /usr/share/openvswitch/bugtool-plugins/
258 /usr/share/openvswitch/python/
259 /usr/share/openvswitch/scripts/ovs-bugtool-*
260 /usr/share/openvswitch/scripts/ovs-check-dead-ifs
261 /usr/share/openvswitch/scripts/ovs-ctl
262 /usr/share/openvswitch/scripts/ovs-kmod-ctl
263 /usr/share/openvswitch/scripts/ovs-lib
264 /usr/share/openvswitch/scripts/ovs-save
265 /usr/share/openvswitch/scripts/ovs-vtep
266 /usr/share/openvswitch/scripts/sysconfig.template
267 /usr/share/openvswitch/scripts/ovs-monitor-ipsec
268 /usr/share/openvswitch/vswitch.ovsschema
269 /usr/share/openvswitch/vtep.ovsschema
270 %doc NOTICE README.rst NEWS rhel/README.RHEL.rst
271 /var/lib/openvswitch
272 /var/log/openvswitch
273
274 %files devel
275 %{_libdir}/lib*.so
276 %{_libdir}/lib*.a
277 %{_libdir}/pkgconfig
278 %{_includedir}/openvswitch/*
279
280 %files selinux-policy
281 %defattr(-,root,root)
282 %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp