]>
Commit | Line | Data |
---|---|---|
c434706a BP |
1 | # Spec file for Open vSwitch on Red Hat Enterprise Linux. |
2 | ||
0bc1b46a | 3 | # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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 | |
7f8350b0 | 25 | Requires: logrotate, python |
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 | ||
35 | %prep | |
36 | %setup -q | |
37 | ||
38 | %build | |
8a07709c | 39 | ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --enable-ssl |
c434706a BP |
40 | make %{_smp_mflags} |
41 | ||
42 | %install | |
43 | rm -rf $RPM_BUILD_ROOT | |
44 | make install DESTDIR=$RPM_BUILD_ROOT | |
53755990 CW |
45 | |
46 | rhel_cp() { | |
47 | base=$1 | |
48 | mode=$2 | |
49 | dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g') | |
50 | install -D -m $mode rhel/$base $dst | |
51 | } | |
52 | rhel_cp etc_init.d_openvswitch 0755 | |
53 | rhel_cp etc_logrotate.d_openvswitch 0644 | |
54 | rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755 | |
55 | rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755 | |
56 | rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644 | |
57 | ||
6c88547d EJ |
58 | install python/compat/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python |
59 | install python/compat/argparse.py $RPM_BUILD_ROOT/usr/share/openvswitch/python | |
c434706a BP |
60 | |
61 | # Get rid of stuff we don't want to make RPM happy. | |
62 | rm \ | |
0bc1b46a BP |
63 | $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \ |
64 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \ | |
9d7c5643 | 65 | $RPM_BUILD_ROOT/usr/bin/ovs-test \ |
2d8bdd8f | 66 | $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \ |
9d7c5643 | 67 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \ |
2d8bdd8f | 68 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \ |
c434706a BP |
69 | $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \ |
70 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 | |
d893c3e0 | 71 | (cd "$RPM_BUILD_ROOT" && rm -rf usr/lib) |
c434706a BP |
72 | |
73 | install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch | |
74 | ||
329cf232 GS |
75 | %check |
76 | %if %{with check} | |
77 | if make check TESTSUITEFLAGS='%{_smp_mflags}' || | |
78 | make check TESTSUITEFLAGS='--recheck'; then :; | |
79 | else | |
80 | cat tests/testsuite.log | |
81 | exit 1 | |
82 | fi | |
83 | %endif | |
84 | ||
c434706a BP |
85 | %clean |
86 | rm -rf $RPM_BUILD_ROOT | |
87 | ||
88 | %post | |
89 | # Create default or update existing /etc/sysconfig/openvswitch. | |
90 | SYSCONFIG=/etc/sysconfig/openvswitch | |
91 | TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template | |
92 | if [ ! -e $SYSCONFIG ]; then | |
93 | cp $TEMPLATE $SYSCONFIG | |
94 | else | |
95 | for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE) | |
96 | do | |
97 | if ! grep $var $SYSCONFIG >/dev/null 2>&1; then | |
98 | echo >> $SYSCONFIG | |
99 | sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG | |
100 | fi | |
101 | done | |
102 | fi | |
103 | ||
104 | # Ensure all required services are set to run | |
105 | /sbin/chkconfig --add openvswitch | |
106 | /sbin/chkconfig openvswitch on | |
107 | ||
108 | %preun | |
109 | if [ "$1" = "0" ]; then # $1 = 0 for uninstall | |
110 | /sbin/service openvswitch stop | |
111 | /sbin/chkconfig --del openvswitch | |
112 | fi | |
113 | ||
114 | %postun | |
115 | if [ "$1" = "0" ]; then # $1 = 0 for uninstall | |
116 | rm -f /etc/openvswitch/conf.db | |
117 | rm -f /etc/sysconfig/openvswitch | |
118 | rm -f /etc/openvswitch/vswitchd.cacert | |
119 | fi | |
120 | ||
121 | exit 0 | |
122 | ||
123 | %files | |
124 | %defattr(-,root,root) | |
125 | /etc/init.d/openvswitch | |
53755990 | 126 | %config(noreplace) /etc/logrotate.d/openvswitch |
0fb42626 AF |
127 | /etc/sysconfig/network-scripts/ifup-ovs |
128 | /etc/sysconfig/network-scripts/ifdown-ovs | |
c434706a | 129 | /usr/bin/ovs-appctl |
5e00790e | 130 | /usr/bin/ovs-benchmark |
c434706a | 131 | /usr/bin/ovs-dpctl |
14b4c575 | 132 | /usr/bin/ovs-dpctl-top |
ec8f0f0c | 133 | /usr/bin/ovs-docker |
c434706a | 134 | /usr/bin/ovs-ofctl |
013061cf | 135 | /usr/bin/ovs-parse-backtrace |
c434706a | 136 | /usr/bin/ovs-pcap |
def046d5 | 137 | /usr/bin/ovs-pki |
c434706a BP |
138 | /usr/bin/ovs-tcpundump |
139 | /usr/bin/ovs-vlan-test | |
140 | /usr/bin/ovs-vsctl | |
141 | /usr/bin/ovsdb-client | |
142 | /usr/bin/ovsdb-tool | |
dd2d06c3 | 143 | /usr/bin/vtep-ctl |
51a5f442 | 144 | /usr/sbin/ovs-bugtool |
c434706a BP |
145 | /usr/sbin/ovs-vswitchd |
146 | /usr/sbin/ovsdb-server | |
5e00790e | 147 | /usr/share/man/man1/ovs-benchmark.1.gz |
c434706a BP |
148 | /usr/share/man/man1/ovs-pcap.1.gz |
149 | /usr/share/man/man1/ovs-tcpundump.1.gz | |
150 | /usr/share/man/man1/ovsdb-client.1.gz | |
151 | /usr/share/man/man1/ovsdb-server.1.gz | |
152 | /usr/share/man/man1/ovsdb-tool.1.gz | |
153 | /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz | |
dd2d06c3 | 154 | /usr/share/man/man5/vtep.5.gz |
c434706a | 155 | /usr/share/man/man8/ovs-appctl.8.gz |
2ad7bf32 | 156 | /usr/share/man/man8/ovs-bugtool.8.gz |
c434706a BP |
157 | /usr/share/man/man8/ovs-ctl.8.gz |
158 | /usr/share/man/man8/ovs-dpctl.8.gz | |
14b4c575 | 159 | /usr/share/man/man8/ovs-dpctl-top.8.gz |
c434706a | 160 | /usr/share/man/man8/ovs-ofctl.8.gz |
013061cf | 161 | /usr/share/man/man8/ovs-parse-backtrace.8.gz |
def046d5 | 162 | /usr/share/man/man8/ovs-pki.8.gz |
c434706a BP |
163 | /usr/share/man/man8/ovs-vlan-test.8.gz |
164 | /usr/share/man/man8/ovs-vsctl.8.gz | |
165 | /usr/share/man/man8/ovs-vswitchd.8.gz | |
dd2d06c3 | 166 | /usr/share/man/man8/vtep-ctl.8.gz |
4b38c153 | 167 | /usr/share/openvswitch/bugtool-plugins/ |
c434706a | 168 | /usr/share/openvswitch/python/ |
b2df0225 | 169 | /usr/share/openvswitch/scripts/ovs-bugtool-* |
2dc7590d | 170 | /usr/share/openvswitch/scripts/ovs-check-dead-ifs |
c434706a | 171 | /usr/share/openvswitch/scripts/ovs-ctl |
d422c118 | 172 | /usr/share/openvswitch/scripts/ovs-lib |
c434706a | 173 | /usr/share/openvswitch/scripts/ovs-save |
dd2d06c3 | 174 | /usr/share/openvswitch/scripts/ovs-vtep |
c434706a BP |
175 | /usr/share/openvswitch/scripts/sysconfig.template |
176 | /usr/share/openvswitch/vswitch.ovsschema | |
dd2d06c3 | 177 | /usr/share/openvswitch/vtep.ovsschema |
542cc9bb TG |
178 | %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md FAQ.md NEWS |
179 | %doc INSTALL.DPDK.md rhel/README.RHEL | |
c434706a | 180 | /var/lib/openvswitch |
c649fe54 | 181 | /var/log/openvswitch |