]> git.proxmox.com Git - mirror_ovs.git/blob - rhel/openvswitch.spec.in
rhel: user/group openvswitch does not exist
[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
42 %bcond_without check
43 %bcond_with check_datapath_kernel
44
45 %description
46 Open vSwitch provides standard network bridging functions and
47 support for the OpenFlow protocol for remote per-flow control of
48 traffic.
49
50 %package devel
51 Summary: Open vSwitch development package
52 Group: Development/Libraries
53
54 %description devel
55 This package provides openvswitch headers and libopenvswitch for developers.
56
57 %package selinux-policy
58 Summary: Open vSwitch SELinux policy
59 License: ASL 2.0
60 BuildArch: noarch
61 Requires: selinux-policy-targeted
62
63 %description selinux-policy
64 Tailored Open vSwitch SELinux policy
65
66 %prep
67 %setup -q
68
69 %build
70 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \
71 --libdir=%{_libdir} --enable-ssl --enable-shared
72 make %{_smp_mflags}
73 make selinux-policy
74
75 %install
76 rm -rf $RPM_BUILD_ROOT
77 make install DESTDIR=$RPM_BUILD_ROOT
78
79 rhel_cp() {
80 base=$1
81 mode=$2
82 dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g')
83 install -D -m $mode rhel/$base $dst
84 }
85 rhel_cp etc_init.d_openvswitch 0755
86 rhel_cp etc_logrotate.d_openvswitch 0644
87 rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755
88 rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755
89 rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644
90
91 install -p -m 644 -D selinux/openvswitch-custom.pp \
92 $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
93
94 # Get rid of stuff we don't want to make RPM happy.
95 rm \
96 $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \
97 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \
98 $RPM_BUILD_ROOT/usr/bin/ovs-test \
99 $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
100 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \
101 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
102 $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \
103 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 \
104 $RPM_BUILD_ROOT/usr/bin/ovn-* \
105 $RPM_BUILD_ROOT/usr/share/man/man?/ovn-* \
106 $RPM_BUILD_ROOT/usr/share/openvswitch/ovn-* \
107 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn*
108 (cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la)
109 (cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
110
111 install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
112 install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
113 install -d -m 0755 $RPM_BUILD_ROOT/var/lib/openvswitch
114
115 copy_headers() {
116 src=$1
117 dst=$RPM_BUILD_ROOT/$2
118 install -d -m 0755 $dst
119 install -m 0644 $src/*.h $dst
120 }
121 copy_headers include %{_includedir}/openvswitch
122 copy_headers include/openflow %{_includedir}/openvswitch/openflow
123 copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch
124 copy_headers include/sparse %{_includedir}/openvswitch/sparse
125 copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa
126 copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet
127 copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys
128 copy_headers lib %{_includedir}/openvswitch/lib
129
130 install -D -m 0644 lib/.libs/libopenvswitch.a \
131 $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
132
133 %check
134 %if %{with check}
135 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
136 else
137 cat tests/testsuite.log
138 exit 1
139 fi
140 %endif
141 %if %{with check_datapath_kernel}
142 if make check-kernel RECHECK=yes; then :;
143 else
144 cat tests/system-kmod-testsuite.log
145 exit 1
146 fi
147 %endif
148
149 %clean
150 rm -rf $RPM_BUILD_ROOT
151
152 %post
153 # Create default or update existing /etc/sysconfig/openvswitch.
154 SYSCONFIG=/etc/sysconfig/openvswitch
155 TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
156 if [ ! -e $SYSCONFIG ]; then
157 cp $TEMPLATE $SYSCONFIG
158 else
159 for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
160 do
161 if ! grep $var $SYSCONFIG >/dev/null 2>&1; then
162 echo >> $SYSCONFIG
163 sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG
164 fi
165 done
166 fi
167
168 # Ensure all required services are set to run
169 /sbin/chkconfig --add openvswitch
170 /sbin/chkconfig openvswitch on
171
172 %post selinux-policy
173 /usr/sbin/semodule -i %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || :
174
175 %preun
176 if [ "$1" = "0" ]; then # $1 = 0 for uninstall
177 /sbin/service openvswitch stop
178 /sbin/chkconfig --del openvswitch
179 fi
180
181 %postun
182 if [ "$1" = "0" ]; then # $1 = 0 for uninstall
183 rm -f /etc/openvswitch/conf.db
184 rm -f /etc/sysconfig/openvswitch
185 rm -f /etc/openvswitch/vswitchd.cacert
186 fi
187
188 %postun selinux-policy
189 if [ $1 -eq 0 ] ; then
190 /usr/sbin/semodule -r openvswitch-custom &> /dev/null || :
191 fi
192
193 exit 0
194
195 %files
196 %defattr(-,root,root)
197 %dir /etc/openvswitch
198 /etc/bash_completion.d/ovs-appctl-bashcomp.bash
199 /etc/bash_completion.d/ovs-vsctl-bashcomp.bash
200 /etc/init.d/openvswitch
201 %config(noreplace) /etc/logrotate.d/openvswitch
202 /etc/sysconfig/network-scripts/ifup-ovs
203 /etc/sysconfig/network-scripts/ifdown-ovs
204 /usr/bin/ovs-appctl
205 /usr/bin/ovs-dpctl
206 /usr/bin/ovs-dpctl-top
207 /usr/bin/ovs-docker
208 /usr/bin/ovs-ofctl
209 /usr/bin/ovs-parse-backtrace
210 /usr/bin/ovs-pcap
211 /usr/bin/ovs-pki
212 /usr/bin/ovs-tcpdump
213 /usr/bin/ovs-tcpundump
214 /usr/bin/ovs-vlan-test
215 /usr/bin/ovs-vsctl
216 /usr/bin/ovsdb-client
217 /usr/bin/ovsdb-tool
218 /usr/bin/vtep-ctl
219 %{_libdir}/lib*.so.*
220 /usr/sbin/ovs-bugtool
221 /usr/sbin/ovs-vswitchd
222 /usr/sbin/ovsdb-server
223 /usr/share/man/man1/ovs-pcap.1.gz
224 /usr/share/man/man1/ovs-tcpundump.1.gz
225 /usr/share/man/man1/ovsdb-client.1.gz
226 /usr/share/man/man1/ovsdb-server.1.gz
227 /usr/share/man/man1/ovsdb-tool.1.gz
228 /usr/share/man/man5/ovsdb-server.5.gz
229 /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
230 %{_mandir}/man5/ovsdb.5*
231 /usr/share/man/man5/vtep.5.gz
232 /usr/share/man/man7/ovs-fields.7.gz
233 %{_mandir}/man7/ovsdb.7*
234 %{_mandir}/man7/ovsdb-server.7*
235 /usr/share/man/man8/ovs-appctl.8.gz
236 /usr/share/man/man8/ovs-bugtool.8.gz
237 /usr/share/man/man8/ovs-ctl.8.gz
238 /usr/share/man/man8/ovs-dpctl.8.gz
239 /usr/share/man/man8/ovs-dpctl-top.8.gz
240 /usr/share/man/man8/ovs-ofctl.8.gz
241 /usr/share/man/man8/ovs-parse-backtrace.8.gz
242 /usr/share/man/man8/ovs-pki.8.gz
243 /usr/share/man/man8/ovs-tcpdump.8.gz
244 /usr/share/man/man8/ovs-vlan-test.8.gz
245 /usr/share/man/man8/ovs-vsctl.8.gz
246 /usr/share/man/man8/ovs-vswitchd.8.gz
247 /usr/share/man/man8/vtep-ctl.8.gz
248 /usr/share/openvswitch/bugtool-plugins/
249 /usr/share/openvswitch/python/
250 /usr/share/openvswitch/scripts/ovs-bugtool-*
251 /usr/share/openvswitch/scripts/ovs-check-dead-ifs
252 /usr/share/openvswitch/scripts/ovs-ctl
253 /usr/share/openvswitch/scripts/ovs-lib
254 /usr/share/openvswitch/scripts/ovs-save
255 /usr/share/openvswitch/scripts/ovs-vtep
256 /usr/share/openvswitch/scripts/sysconfig.template
257 /usr/share/openvswitch/vswitch.ovsschema
258 /usr/share/openvswitch/vtep.ovsschema
259 %doc NOTICE README.rst NEWS rhel/README.RHEL.rst
260 /var/lib/openvswitch
261 /var/log/openvswitch
262
263 %files devel
264 %{_libdir}/lib*.so
265 %{_libdir}/lib*.a
266 %{_libdir}/pkgconfig
267 %{_includedir}/openvswitch/*
268
269 %files selinux-policy
270 %defattr(-,root,root)
271 %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp