diff options
| author | Amy Fong <amy.fong@windriver.com> | 2015-01-29 13:28:08 -0500 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2015-02-03 14:10:55 -0500 |
| commit | 32158754790dfdd32a404aa609f4709a0753c9d5 (patch) | |
| tree | bed5c39888d3d51ce43402350d75e09144833a93 /recipes-networking/openvswitch/openvswitch.inc | |
| parent | 2905d87e7e4f11573e9c12ed85ff70e4aefc701f (diff) | |
| download | meta-virtualization-32158754790dfdd32a404aa609f4709a0753c9d5.tar.gz | |
openvswitch: restructure recipes
Add openvswitch.inc, removing common parts out of openvswitch*.bb
Signed-off-by: Amy Fong <amy.fong@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-networking/openvswitch/openvswitch.inc')
| -rw-r--r-- | recipes-networking/openvswitch/openvswitch.inc | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/recipes-networking/openvswitch/openvswitch.inc b/recipes-networking/openvswitch/openvswitch.inc new file mode 100644 index 00000000..ed979200 --- /dev/null +++ b/recipes-networking/openvswitch/openvswitch.inc | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | SUMMARY = "OpenvSwitch" | ||
| 2 | DESCRIPTION = "\ | ||
| 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 | |||
| 10 | HOMEPAGE = "http://openvswitch.org/" | ||
| 11 | SECTION = "networking" | ||
| 12 | LICENSE = "Apache-2" | ||
| 13 | |||
| 14 | DEPENDS += "bridge-utils openssl python perl" | ||
| 15 | |||
| 16 | RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \ | ||
| 17 | python perl perl-module-strict ${PN}-switch ${PN}-controller" | ||
| 18 | RDEPENDS_${PN}-controller = "${PN} lsb ${PN}-pki" | ||
| 19 | RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen" | ||
| 20 | RDEPENDS_${PN}-pki = "${PN}" | ||
| 21 | RDEPENDS_${PN}-brcompat = "${PN} ${PN}-switch" | ||
| 22 | |||
| 23 | # Some installers will fail because of an install order based on | ||
| 24 | # rdeps. E.g. ovs-pki calls sed in the postinstall. sed may be | ||
| 25 | # queued for install later. | ||
| 26 | RDEPENDS_${PN} += "sed gawk grep" | ||
| 27 | |||
| 28 | SRC_URI = "\ | ||
| 29 | file://openvswitch-switch \ | ||
| 30 | file://openvswitch-switch-setup \ | ||
| 31 | file://openvswitch-controller \ | ||
| 32 | file://openvswitch-controller-setup \ | ||
| 33 | file://openvswitch-add-target-python-handling.patch \ | ||
| 34 | file://openvswitch-add-target-perl-handling.patch \ | ||
| 35 | " | ||
| 36 | |||
| 37 | EXTRA_OECONF += "\ | ||
| 38 | TARGET_PYTHON=${bindir}/python \ | ||
| 39 | TARGET_PERL=${bindir}/perl \ | ||
| 40 | " | ||
| 41 | |||
| 42 | # Don't compile kernel modules by default since it heavily depends on | ||
| 43 | # kernel version. Use the in-kernel module for now. | ||
| 44 | # distro layers can enable with EXTRA_OECONF_pn_openvswitch += "" | ||
| 45 | # EXTRA_OECONF = "--with-linux=${STAGING_KERNEL_DIR} KARCH=${TARGET_ARCH}" | ||
| 46 | |||
| 47 | ALLOW_EMPTY_${PN}-pki = "1" | ||
| 48 | PACKAGES =+ "${PN}-controller ${PN}-switch ${PN}-brcompat ${PN}-pki" | ||
| 49 | |||
| 50 | FILES_${PN}-controller = "\ | ||
| 51 | ${sysconfdir}/init.d/openvswitch-controller \ | ||
| 52 | ${sysconfdir}/default/openvswitch-controller \ | ||
| 53 | ${sysconfdir}/openvswitch-controller \ | ||
| 54 | ${bindir}/ovs-controller \ | ||
| 55 | " | ||
| 56 | |||
| 57 | FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd" | ||
| 58 | |||
| 59 | FILES_${PN}-switch = "\ | ||
| 60 | ${sysconfdir}/init.d/openvswitch-switch \ | ||
| 61 | ${sysconfdir}/default/openvswitch-switch \ | ||
| 62 | " | ||
| 63 | |||
| 64 | # silence a warning | ||
| 65 | FILES_${PN} += "${datadir}/ovsdbmonitor" | ||
| 66 | FILES_${PN} += "/run" | ||
| 67 | |||
| 68 | inherit autotools update-rc.d | ||
| 69 | |||
| 70 | INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-controller" | ||
| 71 | INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch" | ||
| 72 | INITSCRIPT_PARAMS_${PN}-switch = "defaults 71" | ||
| 73 | |||
| 74 | INITSCRIPT_NAME_${PN}-controller = "openvswitch-controller" | ||
| 75 | INITSCRIPT_PARAMS_${PN}-controller = "defaults 72" | ||
| 76 | |||
| 77 | do_install_append() { | ||
| 78 | install -d ${D}/${sysconfdir}/default/ | ||
| 79 | install -m 660 ${WORKDIR}/openvswitch-switch-setup ${D}/${sysconfdir}/default/openvswitch-switch | ||
| 80 | install -d ${D}/${sysconfdir}/openvswitch-controller | ||
| 81 | install -m 660 ${WORKDIR}/openvswitch-controller-setup ${D}/${sysconfdir}/default/openvswitch-controller | ||
| 82 | |||
| 83 | install -d ${D}/${sysconfdir}/init.d/ | ||
| 84 | install -m 755 ${WORKDIR}/openvswitch-controller ${D}/${sysconfdir}/init.d/openvswitch-controller | ||
| 85 | install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch | ||
| 86 | true || rm -fr ${D}/${datadir}/${PN}/pki | ||
| 87 | |||
| 88 | install -d ${D}/${sysconfdir}/init.d/ | ||
| 89 | |||
| 90 | oe_runmake modules_install INSTALL_MOD_PATH=${D} | ||
| 91 | } | ||
| 92 | |||
| 93 | pkg_postinst_${PN}-pki () { | ||
| 94 | # can't do this offline | ||
| 95 | if [ "x$D" != "x" ]; then | ||
| 96 | exit 1 | ||
| 97 | fi | ||
| 98 | if test ! -d $D/${datadir}/${PN}/pki; then | ||
| 99 | ovs-pki init --dir=$D/${datadir}/${PN}/pki | ||
| 100 | fi | ||
| 101 | } | ||
| 102 | |||
| 103 | pkg_postinst_${PN}-controller () { | ||
| 104 | # can't do this offline | ||
| 105 | if [ "x$D" != "x" ]; then | ||
| 106 | exit 1 | ||
| 107 | fi | ||
| 108 | |||
| 109 | if test ! -d $D/${datadir}/${PN}/pki; then | ||
| 110 | ovs-pki init --dir=$D/${datadir}/${PN}/pki | ||
| 111 | fi | ||
| 112 | |||
| 113 | cd $D/${sysconfdir}/openvswitch-controller | ||
| 114 | if ! test -e cacert.pem; then | ||
| 115 | ln -s $D/${datadir}/${PN}/pki/switchca/cacert.pem cacert.pem | ||
| 116 | fi | ||
| 117 | if ! test -e privkey.pem || ! test -e cert.pem; then | ||
| 118 | oldumask=$(umask) | ||
| 119 | umask 077 | ||
| 120 | ovs-pki req+sign --dir=$D/${datadir}/${PN}/pki tmp controller >/dev/null | ||
| 121 | mv tmp-privkey.pem privkey.pem | ||
| 122 | mv tmp-cert.pem cert.pem | ||
| 123 | mv tmp-req.pem req.pem | ||
| 124 | chmod go+r cert.pem req.pem | ||
| 125 | umask $oldumask | ||
| 126 | fi | ||
| 127 | } | ||
