]>
Commit | Line | Data |
---|---|---|
c434706a BP |
1 | # Spec file for Open vSwitch on Red Hat Enterprise Linux. |
2 | ||
e7529141 | 3 | # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. |
c434706a BP |
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. | |
329cf232 GS |
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 | |
c434706a BP |
13 | |
14 | Name: openvswitch | |
15 | Summary: Open vSwitch daemon/database/utilities | |
16 | Group: System Environment/Daemons | |
17 | URL: http://www.openvswitch.org/ | |
e0edde6f | 18 | Vendor: Nicira, Inc. |
c434706a BP |
19 | Version: @VERSION@ |
20 | ||
21 | License: ASL 2.0 | |
22 | Release: 1 | |
23 | Source: openvswitch-%{version}.tar.gz | |
24 | Buildroot: /tmp/openvswitch-rpm | |
73eb682e | 25 | Requires: logrotate, python >= 2.7, python-six |
4465062f | 26 | BuildRequires: openssl-devel |
c434706a | 27 | |
329cf232 GS |
28 | %bcond_without check |
29 | ||
c434706a BP |
30 | %description |
31 | Open vSwitch provides standard network bridging functions and | |
32 | support for the OpenFlow protocol for remote per-flow control of | |
33 | traffic. | |
34 | ||
4886d4d2 EC |
35 | %package devel |
36 | Summary: Open vSwitch development package | |
37 | Group: Development/Libraries | |
38 | ||
39 | %description devel | |
40 | This package provides openvswitch headers and libopenvswitch for developers. | |
41 | ||
c434706a BP |
42 | %prep |
43 | %setup -q | |
44 | ||
45 | %build | |
4886d4d2 EC |
46 | ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \ |
47 | --libdir=%{_libdir} --enable-ssl --enable-shared | |
c434706a BP |
48 | make %{_smp_mflags} |
49 | ||
50 | %install | |
51 | rm -rf $RPM_BUILD_ROOT | |
52 | make install DESTDIR=$RPM_BUILD_ROOT | |
53755990 CW |
53 | |
54 | rhel_cp() { | |
55 | base=$1 | |
56 | mode=$2 | |
57 | dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g') | |
58 | install -D -m $mode rhel/$base $dst | |
59 | } | |
60 | rhel_cp etc_init.d_openvswitch 0755 | |
61 | rhel_cp etc_logrotate.d_openvswitch 0644 | |
62 | rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755 | |
63 | rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755 | |
64 | rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644 | |
65 | ||
c434706a BP |
66 | # Get rid of stuff we don't want to make RPM happy. |
67 | rm \ | |
0bc1b46a BP |
68 | $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \ |
69 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \ | |
9d7c5643 | 70 | $RPM_BUILD_ROOT/usr/bin/ovs-test \ |
2d8bdd8f | 71 | $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \ |
9d7c5643 | 72 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \ |
2d8bdd8f | 73 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \ |
c434706a | 74 | $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \ |
1247b5a7 PM |
75 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 \ |
76 | $RPM_BUILD_ROOT/usr/bin/ovn-* \ | |
77 | $RPM_BUILD_ROOT/usr/share/man/man?/ovn-* \ | |
78 | $RPM_BUILD_ROOT/usr/share/openvswitch/ovn-* \ | |
79 | $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn-* | |
4886d4d2 | 80 | (cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la) |
2fd84d5e | 81 | (cd "$RPM_BUILD_ROOT" && rm -rf usr/include) |
c434706a BP |
82 | |
83 | install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch | |
84 | ||
4886d4d2 EC |
85 | copy_headers() { |
86 | src=$1 | |
87 | dst=$RPM_BUILD_ROOT/$2 | |
88 | install -d -m 0755 $dst | |
89 | install -m 0644 $src/*.h $dst | |
90 | } | |
91 | copy_headers include %{_includedir}/openvswitch | |
92 | copy_headers include/openflow %{_includedir}/openvswitch/openflow | |
93 | copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch | |
94 | copy_headers include/sparse %{_includedir}/openvswitch/sparse | |
95 | copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa | |
96 | copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet | |
97 | copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys | |
98 | copy_headers lib %{_includedir}/openvswitch/lib | |
99 | ||
100 | install -D -m 0644 lib/.libs/libopenvswitch.a \ | |
101 | $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a | |
102 | ||
329cf232 GS |
103 | %check |
104 | %if %{with check} | |
0d3f2152 | 105 | if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :; |
329cf232 GS |
106 | else |
107 | cat tests/testsuite.log | |
108 | exit 1 | |
109 | fi | |
110 | %endif | |
111 | ||
c434706a BP |
112 | %clean |
113 | rm -rf $RPM_BUILD_ROOT | |
114 | ||
115 | %post | |
116 | # Create default or update existing /etc/sysconfig/openvswitch. | |
117 | SYSCONFIG=/etc/sysconfig/openvswitch | |
118 | TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template | |
119 | if [ ! -e $SYSCONFIG ]; then | |
120 | cp $TEMPLATE $SYSCONFIG | |
121 | else | |
122 | for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE) | |
123 | do | |
124 | if ! grep $var $SYSCONFIG >/dev/null 2>&1; then | |
125 | echo >> $SYSCONFIG | |
126 | sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG | |
127 | fi | |
128 | done | |
129 | fi | |
130 | ||
131 | # Ensure all required services are set to run | |
132 | /sbin/chkconfig --add openvswitch | |
133 | /sbin/chkconfig openvswitch on | |
134 | ||
135 | %preun | |
136 | if [ "$1" = "0" ]; then # $1 = 0 for uninstall | |
137 | /sbin/service openvswitch stop | |
138 | /sbin/chkconfig --del openvswitch | |
139 | fi | |
140 | ||
141 | %postun | |
142 | if [ "$1" = "0" ]; then # $1 = 0 for uninstall | |
143 | rm -f /etc/openvswitch/conf.db | |
144 | rm -f /etc/sysconfig/openvswitch | |
145 | rm -f /etc/openvswitch/vswitchd.cacert | |
146 | fi | |
147 | ||
148 | exit 0 | |
149 | ||
150 | %files | |
151 | %defattr(-,root,root) | |
f0dc83b7 | 152 | %dir /etc/openvswitch |
2c9907cd AW |
153 | /etc/bash_completion.d/ovs-appctl-bashcomp.bash |
154 | /etc/bash_completion.d/ovs-vsctl-bashcomp.bash | |
c434706a | 155 | /etc/init.d/openvswitch |
53755990 | 156 | %config(noreplace) /etc/logrotate.d/openvswitch |
0fb42626 AF |
157 | /etc/sysconfig/network-scripts/ifup-ovs |
158 | /etc/sysconfig/network-scripts/ifdown-ovs | |
c434706a BP |
159 | /usr/bin/ovs-appctl |
160 | /usr/bin/ovs-dpctl | |
14b4c575 | 161 | /usr/bin/ovs-dpctl-top |
ec8f0f0c | 162 | /usr/bin/ovs-docker |
c434706a | 163 | /usr/bin/ovs-ofctl |
013061cf | 164 | /usr/bin/ovs-parse-backtrace |
c434706a | 165 | /usr/bin/ovs-pcap |
def046d5 | 166 | /usr/bin/ovs-pki |
f75fe487 | 167 | /usr/bin/ovs-tcpdump |
c434706a BP |
168 | /usr/bin/ovs-tcpundump |
169 | /usr/bin/ovs-vlan-test | |
170 | /usr/bin/ovs-vsctl | |
171 | /usr/bin/ovsdb-client | |
172 | /usr/bin/ovsdb-tool | |
dd2d06c3 | 173 | /usr/bin/vtep-ctl |
4886d4d2 | 174 | %{_libdir}/lib*.so.* |
51a5f442 | 175 | /usr/sbin/ovs-bugtool |
c434706a BP |
176 | /usr/sbin/ovs-vswitchd |
177 | /usr/sbin/ovsdb-server | |
178 | /usr/share/man/man1/ovs-pcap.1.gz | |
179 | /usr/share/man/man1/ovs-tcpundump.1.gz | |
180 | /usr/share/man/man1/ovsdb-client.1.gz | |
181 | /usr/share/man/man1/ovsdb-server.1.gz | |
182 | /usr/share/man/man1/ovsdb-tool.1.gz | |
183 | /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz | |
dd2d06c3 | 184 | /usr/share/man/man5/vtep.5.gz |
c434706a | 185 | /usr/share/man/man8/ovs-appctl.8.gz |
2ad7bf32 | 186 | /usr/share/man/man8/ovs-bugtool.8.gz |
c434706a BP |
187 | /usr/share/man/man8/ovs-ctl.8.gz |
188 | /usr/share/man/man8/ovs-dpctl.8.gz | |
14b4c575 | 189 | /usr/share/man/man8/ovs-dpctl-top.8.gz |
c434706a | 190 | /usr/share/man/man8/ovs-ofctl.8.gz |
013061cf | 191 | /usr/share/man/man8/ovs-parse-backtrace.8.gz |
def046d5 | 192 | /usr/share/man/man8/ovs-pki.8.gz |
f75fe487 | 193 | /usr/share/man/man8/ovs-tcpdump.8.gz |
c434706a BP |
194 | /usr/share/man/man8/ovs-vlan-test.8.gz |
195 | /usr/share/man/man8/ovs-vsctl.8.gz | |
196 | /usr/share/man/man8/ovs-vswitchd.8.gz | |
dd2d06c3 | 197 | /usr/share/man/man8/vtep-ctl.8.gz |
4b38c153 | 198 | /usr/share/openvswitch/bugtool-plugins/ |
c434706a | 199 | /usr/share/openvswitch/python/ |
b2df0225 | 200 | /usr/share/openvswitch/scripts/ovs-bugtool-* |
2dc7590d | 201 | /usr/share/openvswitch/scripts/ovs-check-dead-ifs |
c434706a | 202 | /usr/share/openvswitch/scripts/ovs-ctl |
d422c118 | 203 | /usr/share/openvswitch/scripts/ovs-lib |
c434706a | 204 | /usr/share/openvswitch/scripts/ovs-save |
dd2d06c3 | 205 | /usr/share/openvswitch/scripts/ovs-vtep |
c434706a BP |
206 | /usr/share/openvswitch/scripts/sysconfig.template |
207 | /usr/share/openvswitch/vswitch.ovsschema | |
dd2d06c3 | 208 | /usr/share/openvswitch/vtep.ovsschema |
542cc9bb | 209 | %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md FAQ.md NEWS |
a36de779 | 210 | %doc INSTALL.DPDK.md rhel/README.RHEL README-native-tunneling.md |
c434706a | 211 | /var/lib/openvswitch |
c649fe54 | 212 | /var/log/openvswitch |
4886d4d2 EC |
213 | |
214 | %files devel | |
215 | %{_libdir}/lib*.so | |
216 | %{_libdir}/lib*.a | |
217 | %{_libdir}/pkgconfig | |
218 | %{_includedir}/openvswitch/* |