blob: 3c70703a73e945591b3e5af75703278dbf93d21c [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -05001SUMMARY = "OpenvSwitch"
2DESCRIPTION = "\
3 Open vSwitch is a production quality, multilayer virtual switch \
4 licensed under the open source Apache 2.0 license. It is designed \
5 to enable massive network automation through programmatic extension, \
6 while still supporting standard management interfaces and protocols \
7 (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag) \
8 "
9
10HOMEPAGE = "http://openvswitch.org/"
11SECTION = "networking"
12LICENSE = "Apache-2"
13
14DEPENDS += "bridge-utils openssl python perl"
15
16RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \
17 python perl perl-module-strict ${PN}-switch \
Patrick Williamse69d2352017-02-23 20:56:04 -060018 bash python-twisted"
Patrick Williamsd849ec72016-08-17 14:59:38 -050019RDEPENDS_${PN}-testcontroller = "${PN} lsb ${PN}-pki"
20RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen"
21RDEPENDS_${PN}-pki = "${PN}"
22RDEPENDS_${PN}-brcompat = "${PN} ${PN}-switch"
23
24# Some installers will fail because of an install order based on
25# rdeps. E.g. ovs-pki calls sed in the postinstall. sed may be
26# queued for install later.
27RDEPENDS_${PN} += "sed gawk grep"
28
29SRC_URI = "\
30 file://openvswitch-switch \
31 file://openvswitch-switch-setup \
32 file://openvswitch-testcontroller \
33 file://openvswitch-testcontroller-setup \
34 file://openvswitch-add-target-python-handling.patch \
35 file://openvswitch-add-target-perl-handling.patch \
36 "
37
38EXTRA_OECONF += "\
39 TARGET_PYTHON=${bindir}/python \
40 TARGET_PERL=${bindir}/perl \
41 "
42CONFIGUREOPT_DEPTRACK = ""
43
44# Don't compile kernel modules by default since it heavily depends on
45# kernel version. Use the in-kernel module for now.
46# distro layers can enable with EXTRA_OECONF_pn_openvswitch += ""
47# EXTRA_OECONF = "--with-linux=${STAGING_KERNEL_DIR} KARCH=${TARGET_ARCH}"
48
49ALLOW_EMPTY_${PN}-pki = "1"
50PACKAGES =+ "${PN}-testcontroller ${PN}-switch ${PN}-brcompat ${PN}-pki"
51
52FILES_${PN}-testcontroller = "\
53 ${sysconfdir}/init.d/openvswitch-testcontroller \
54 ${sysconfdir}/default/openvswitch-testcontroller \
55 ${sysconfdir}/openvswitch-testcontroller \
56 ${bindir}/ovs-testcontroller \
57 "
58
59FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd"
60
61FILES_${PN}-switch = "\
62 ${sysconfdir}/init.d/openvswitch-switch \
63 ${sysconfdir}/default/openvswitch-switch \
64 ${systemd_unitdir}/system/openvswitch.service \
65 ${systemd_unitdir}/system/openvswitch-nonetwork.service \
66 "
67
68# silence a warning
69FILES_${PN} += "${datadir}/ovsdbmonitor"
70FILES_${PN} += "/run"
71
Patrick Williamse69d2352017-02-23 20:56:04 -060072FILES_${PN} += "${libdir}/python${PYTHON_BASEVERSION}/"
73inherit autotools update-rc.d systemd python-dir
Patrick Williamsd849ec72016-08-17 14:59:38 -050074
75SYSTEMD_PACKAGES = "${PN}-switch"
76SYSTEMD_SERVICE_${PN}-switch = " \
77 openvswitch-nonetwork.service \
78 openvswitch-switch.service \
79"
80
81INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-testcontroller"
82INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch"
83INITSCRIPT_PARAMS_${PN}-switch = "defaults 71"
84
85INITSCRIPT_NAME_${PN}-testcontroller = "openvswitch-testcontroller"
86INITSCRIPT_PARAMS_${PN}-testcontroller = "defaults 72"
87
88do_install_append() {
89 install -d ${D}/${sysconfdir}/default/
90 install -m 660 ${WORKDIR}/openvswitch-switch-setup ${D}/${sysconfdir}/default/openvswitch-switch
91 install -d ${D}/${sysconfdir}/openvswitch-testcontroller
92 install -m 660 ${WORKDIR}/openvswitch-testcontroller-setup ${D}/${sysconfdir}/default/openvswitch-testcontroller
93
94 install -d ${D}/${sysconfdir}/init.d/
95 install -m 755 ${WORKDIR}/openvswitch-testcontroller ${D}/${sysconfdir}/init.d/openvswitch-testcontroller
96 install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch
97 true || rm -fr ${D}/${datadir}/${PN}/pki
98
99 install -d ${D}/${systemd_unitdir}/system/
100 install -m 644 ${S}/rhel/usr_lib_systemd_system_openvswitch.service \
101 ${D}/${systemd_unitdir}/system/openvswitch-switch.service
102 install -m 644 ${S}/rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
103 ${D}/${systemd_unitdir}/system/openvswitch-nonetwork.service
104
105 oe_runmake modules_install INSTALL_MOD_PATH=${D}
Patrick Williamse69d2352017-02-23 20:56:04 -0600106 install -d ${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages
107 cp -r ${S}/python/ovstest/ ${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages/
Patrick Williamsd849ec72016-08-17 14:59:38 -0500108}
109
110pkg_postinst_${PN}-pki () {
111 # can't do this offline
112 if [ "x$D" != "x" ]; then
113 exit 1
114 fi
115 if test ! -d $D/${datadir}/${PN}/pki; then
116 ovs-pki init --dir=$D/${datadir}/${PN}/pki
117 fi
118}
119
120pkg_postinst_${PN}-testcontroller () {
121 # can't do this offline
122 if [ "x$D" != "x" ]; then
123 exit 1
124 fi
125
126 if test ! -d $D/${datadir}/${PN}/pki; then
127 ovs-pki init --dir=$D/${datadir}/${PN}/pki
128 fi
129
130 cd $D/${sysconfdir}/openvswitch-testcontroller
131 if ! test -e cacert.pem; then
132 ln -s $D/${datadir}/${PN}/pki/switchca/cacert.pem cacert.pem
133 fi
134 if ! test -e privkey.pem || ! test -e cert.pem; then
135 oldumask=$(umask)
136 umask 077
137 ovs-pki req+sign --dir=$D/${datadir}/${PN}/pki tmp controller >/dev/null
138 mv tmp-privkey.pem privkey.pem
139 mv tmp-cert.pem cert.pem
140 mv tmp-req.pem req.pem
141 chmod go+r cert.pem req.pem
142 umask $oldumask
143 fi
144}