Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.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 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 Name: openvswitch
11 Summary: Open vSwitch daemon/database/utilities
12 Group: System Environment/Daemons
13 URL: http://www.openvswitch.org/
14 Vendor: Nicira, Inc.
15 Version: @VERSION@
16
17 License: ASL 2.0
18 Release: 1
19 Source: openvswitch-%{version}.tar.gz
20 Buildroot: /tmp/openvswitch-rpm
21 Requires: openvswitch-kmod, logrotate, python
22 BuildRequires: openssl-devel
23
24 %description
25 Open vSwitch provides standard network bridging functions and
26 support for the OpenFlow protocol for remote per-flow control of
27 traffic.
28
29 %prep
30 %setup -q
31
32 %build
33 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --enable-ssl
34 make %{_smp_mflags}
35
36 %install
37 rm -rf $RPM_BUILD_ROOT
38 make install DESTDIR=$RPM_BUILD_ROOT
39
40 rhel_cp() {
41  base=$1
42  mode=$2
43  dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g')
44  install -D -m $mode rhel/$base $dst
45 }
46 rhel_cp etc_init.d_openvswitch 0755
47 rhel_cp etc_logrotate.d_openvswitch 0644
48 rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755
49 rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755
50 rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644
51
52 docdir=$RPM_BUILD_ROOT/usr/share/doc/openvswitch-%{version}
53 install -d -m755 "$docdir"
54 install -m 0644 FAQ rhel/README.RHEL "$docdir"
55 install python/compat/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
56 install python/compat/argparse.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
57
58 # Get rid of stuff we don't want to make RPM happy.
59 rm \
60     $RPM_BUILD_ROOT/usr/bin/ovs-test \
61     $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
62     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \
63     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
64     $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \
65     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8
66 (cd "$RPM_BUILD_ROOT" && rm -rf usr/lib)
67
68 install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
69
70 %clean
71 rm -rf $RPM_BUILD_ROOT
72
73 %post
74 # Create default or update existing /etc/sysconfig/openvswitch.
75 SYSCONFIG=/etc/sysconfig/openvswitch
76 TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
77 if [ ! -e $SYSCONFIG ]; then
78     cp $TEMPLATE $SYSCONFIG
79 else
80     for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
81     do
82         if ! grep $var $SYSCONFIG >/dev/null 2>&1; then
83             echo >> $SYSCONFIG
84             sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG
85         fi
86     done
87 fi
88
89 # Ensure all required services are set to run
90 /sbin/chkconfig --add openvswitch
91 /sbin/chkconfig openvswitch on
92
93 %preun
94 if [ "$1" = "0" ]; then     # $1 = 0 for uninstall
95     /sbin/service openvswitch stop
96     /sbin/chkconfig --del openvswitch
97 fi
98
99 %postun
100 if [ "$1" = "0" ]; then     # $1 = 0 for uninstall
101     rm -f /etc/openvswitch/conf.db
102     rm -f /etc/sysconfig/openvswitch
103     rm -f /etc/openvswitch/vswitchd.cacert
104 fi
105
106 exit 0
107
108 %files
109 %defattr(-,root,root)
110 /etc/init.d/openvswitch
111 %config(noreplace) /etc/logrotate.d/openvswitch
112 /etc/sysconfig/network-scripts/ifup-ovs
113 /etc/sysconfig/network-scripts/ifdown-ovs
114 /usr/bin/ovs-appctl
115 /usr/bin/ovs-benchmark
116 /usr/bin/ovs-dpctl
117 /usr/bin/ovs-dpctl-top
118 /usr/bin/ovs-ofctl
119 /usr/bin/ovs-parse-backtrace
120 /usr/bin/ovs-pcap
121 /usr/bin/ovs-pki
122 /usr/bin/ovs-tcpundump
123 /usr/bin/ovs-vlan-test
124 /usr/bin/ovs-vsctl
125 /usr/bin/ovsdb-client
126 /usr/bin/ovsdb-tool
127 /usr/bin/vtep-ctl
128 /usr/sbin/ovs-bugtool
129 /usr/sbin/ovs-vswitchd
130 /usr/sbin/ovsdb-server
131 /usr/share/man/man1/ovs-benchmark.1.gz
132 /usr/share/man/man1/ovs-pcap.1.gz
133 /usr/share/man/man1/ovs-tcpundump.1.gz
134 /usr/share/man/man1/ovsdb-client.1.gz
135 /usr/share/man/man1/ovsdb-server.1.gz
136 /usr/share/man/man1/ovsdb-tool.1.gz
137 /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
138 /usr/share/man/man5/vtep.5.gz
139 /usr/share/man/man8/ovs-appctl.8.gz
140 /usr/share/man/man8/ovs-bugtool.8.gz
141 /usr/share/man/man8/ovs-ctl.8.gz
142 /usr/share/man/man8/ovs-dpctl.8.gz
143 /usr/share/man/man8/ovs-dpctl-top.8.gz
144 /usr/share/man/man8/ovs-ofctl.8.gz
145 /usr/share/man/man8/ovs-parse-backtrace.8.gz
146 /usr/share/man/man8/ovs-pki.8.gz
147 /usr/share/man/man8/ovs-vlan-test.8.gz
148 /usr/share/man/man8/ovs-vsctl.8.gz
149 /usr/share/man/man8/ovs-vswitchd.8.gz
150 /usr/share/man/man8/vtep-ctl.8.gz
151 /usr/share/openvswitch/bugtool-plugins/
152 /usr/share/openvswitch/python/
153 /usr/share/openvswitch/scripts/ovs-bugtool-*
154 /usr/share/openvswitch/scripts/ovs-check-dead-ifs
155 /usr/share/openvswitch/scripts/ovs-ctl
156 /usr/share/openvswitch/scripts/ovs-lib
157 /usr/share/openvswitch/scripts/ovs-save
158 /usr/share/openvswitch/scripts/ovs-vtep
159 /usr/share/openvswitch/scripts/sysconfig.template
160 /usr/share/openvswitch/vswitch.ovsschema
161 /usr/share/openvswitch/vtep.ovsschema
162 /usr/share/doc/openvswitch-%{version}/FAQ
163 /usr/share/doc/openvswitch-%{version}/README.RHEL
164 /var/lib/openvswitch
165 /var/log/openvswitch