| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 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 \ | 
|  | 18 | bash" | 
|  | 19 | RDEPENDS_${PN}-testcontroller = "${PN} lsb ${PN}-pki" | 
|  | 20 | RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen" | 
|  | 21 | RDEPENDS_${PN}-pki = "${PN}" | 
|  | 22 | RDEPENDS_${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. | 
|  | 27 | RDEPENDS_${PN} += "sed gawk grep" | 
|  | 28 |  | 
|  | 29 | SRC_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 |  | 
|  | 38 | EXTRA_OECONF += "\ | 
|  | 39 | TARGET_PYTHON=${bindir}/python \ | 
|  | 40 | TARGET_PERL=${bindir}/perl \ | 
|  | 41 | " | 
|  | 42 | CONFIGUREOPT_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 |  | 
|  | 49 | ALLOW_EMPTY_${PN}-pki = "1" | 
|  | 50 | PACKAGES =+ "${PN}-testcontroller ${PN}-switch ${PN}-brcompat ${PN}-pki" | 
|  | 51 |  | 
|  | 52 | FILES_${PN}-testcontroller = "\ | 
|  | 53 | ${sysconfdir}/init.d/openvswitch-testcontroller \ | 
|  | 54 | ${sysconfdir}/default/openvswitch-testcontroller \ | 
|  | 55 | ${sysconfdir}/openvswitch-testcontroller \ | 
|  | 56 | ${bindir}/ovs-testcontroller \ | 
|  | 57 | " | 
|  | 58 |  | 
|  | 59 | FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd" | 
|  | 60 |  | 
|  | 61 | FILES_${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 | 
|  | 69 | FILES_${PN} += "${datadir}/ovsdbmonitor" | 
|  | 70 | FILES_${PN} += "/run" | 
|  | 71 |  | 
|  | 72 | inherit autotools update-rc.d systemd | 
|  | 73 |  | 
|  | 74 | SYSTEMD_PACKAGES = "${PN}-switch" | 
|  | 75 | SYSTEMD_SERVICE_${PN}-switch = " \ | 
|  | 76 | openvswitch-nonetwork.service \ | 
|  | 77 | openvswitch-switch.service \ | 
|  | 78 | " | 
|  | 79 |  | 
|  | 80 | INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-testcontroller" | 
|  | 81 | INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch" | 
|  | 82 | INITSCRIPT_PARAMS_${PN}-switch = "defaults 71" | 
|  | 83 |  | 
|  | 84 | INITSCRIPT_NAME_${PN}-testcontroller = "openvswitch-testcontroller" | 
|  | 85 | INITSCRIPT_PARAMS_${PN}-testcontroller = "defaults 72" | 
|  | 86 |  | 
|  | 87 | do_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 |  | 
|  | 107 | pkg_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 |  | 
|  | 117 | pkg_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 | } |