blob: fc515e90813fed65cdd0c11f4d5542bf27572c50 [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 \
18 bash"
19RDEPENDS_${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
72inherit autotools update-rc.d systemd
73
74SYSTEMD_PACKAGES = "${PN}-switch"
75SYSTEMD_SERVICE_${PN}-switch = " \
76 openvswitch-nonetwork.service \
77 openvswitch-switch.service \
78"
79
80INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-testcontroller"
81INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch"
82INITSCRIPT_PARAMS_${PN}-switch = "defaults 71"
83
84INITSCRIPT_NAME_${PN}-testcontroller = "openvswitch-testcontroller"
85INITSCRIPT_PARAMS_${PN}-testcontroller = "defaults 72"
86
87do_install_append() {
88 install -d ${D}/${sysconfdir}/default/
89 install -m 660 ${WORKDIR}/openvswitch-switch-setup ${D}/${sysconfdir}/default/openvswitch-switch
90 install -d ${D}/${sysconfdir}/openvswitch-testcontroller
91 install -m 660 ${WORKDIR}/openvswitch-testcontroller-setup ${D}/${sysconfdir}/default/openvswitch-testcontroller
92
93 install -d ${D}/${sysconfdir}/init.d/
94 install -m 755 ${WORKDIR}/openvswitch-testcontroller ${D}/${sysconfdir}/init.d/openvswitch-testcontroller
95 install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch
96 true || rm -fr ${D}/${datadir}/${PN}/pki
97
98 install -d ${D}/${systemd_unitdir}/system/
99 install -m 644 ${S}/rhel/usr_lib_systemd_system_openvswitch.service \
100 ${D}/${systemd_unitdir}/system/openvswitch-switch.service
101 install -m 644 ${S}/rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
102 ${D}/${systemd_unitdir}/system/openvswitch-nonetwork.service
103
104 oe_runmake modules_install INSTALL_MOD_PATH=${D}
105}
106
107pkg_postinst_${PN}-pki () {
108 # can't do this offline
109 if [ "x$D" != "x" ]; then
110 exit 1
111 fi
112 if test ! -d $D/${datadir}/${PN}/pki; then
113 ovs-pki init --dir=$D/${datadir}/${PN}/pki
114 fi
115}
116
117pkg_postinst_${PN}-testcontroller () {
118 # can't do this offline
119 if [ "x$D" != "x" ]; then
120 exit 1
121 fi
122
123 if test ! -d $D/${datadir}/${PN}/pki; then
124 ovs-pki init --dir=$D/${datadir}/${PN}/pki
125 fi
126
127 cd $D/${sysconfdir}/openvswitch-testcontroller
128 if ! test -e cacert.pem; then
129 ln -s $D/${datadir}/${PN}/pki/switchca/cacert.pem cacert.pem
130 fi
131 if ! test -e privkey.pem || ! test -e cert.pem; then
132 oldumask=$(umask)
133 umask 077
134 ovs-pki req+sign --dir=$D/${datadir}/${PN}/pki tmp controller >/dev/null
135 mv tmp-privkey.pem privkey.pem
136 mv tmp-cert.pem cert.pem
137 mv tmp-req.pem req.pem
138 chmod go+r cert.pem req.pem
139 umask $oldumask
140 fi
141}