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 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 14 | DEPENDS += "bridge-utils openssl python3 perl python3-six-native coreutils-native" |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 15 | |
| 16 | RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 17 | python3 perl perl-module-strict ${PN}-switch \ |
| 18 | bash python3-twisted python3-six" |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 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 \ |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 34 | " |
| 35 | |
| 36 | EXTRA_OECONF += "\ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 37 | PYTHON=python3 \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 38 | PYTHON3=python3 \ |
| 39 | PERL=${bindir}/perl \ |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 40 | " |
| 41 | CONFIGUREOPT_DEPTRACK = "" |
| 42 | |
| 43 | # Don't compile kernel modules by default since it heavily depends on |
| 44 | # kernel version. Use the in-kernel module for now. |
| 45 | # distro layers can enable with EXTRA_OECONF_pn_openvswitch += "" |
| 46 | # EXTRA_OECONF = "--with-linux=${STAGING_KERNEL_DIR} KARCH=${TARGET_ARCH}" |
| 47 | |
| 48 | ALLOW_EMPTY_${PN}-pki = "1" |
| 49 | PACKAGES =+ "${PN}-testcontroller ${PN}-switch ${PN}-brcompat ${PN}-pki" |
| 50 | |
| 51 | FILES_${PN}-testcontroller = "\ |
| 52 | ${sysconfdir}/init.d/openvswitch-testcontroller \ |
| 53 | ${sysconfdir}/default/openvswitch-testcontroller \ |
| 54 | ${sysconfdir}/openvswitch-testcontroller \ |
| 55 | ${bindir}/ovs-testcontroller \ |
| 56 | " |
| 57 | |
| 58 | FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd" |
| 59 | |
| 60 | FILES_${PN}-switch = "\ |
| 61 | ${sysconfdir}/init.d/openvswitch-switch \ |
| 62 | ${sysconfdir}/default/openvswitch-switch \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 63 | ${systemd_unitdir}/system/ovs-vswitchd.service \ |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 64 | ${systemd_unitdir}/system/openvswitch.service \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 65 | ${systemd_unitdir}/system/ovsdb-server.service \ |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 66 | " |
| 67 | |
| 68 | # silence a warning |
| 69 | FILES_${PN} += "${datadir}/ovsdbmonitor" |
| 70 | FILES_${PN} += "/run" |
| 71 | |
Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 72 | FILES_${PN} += "${libdir}/python${PYTHON_BASEVERSION}/" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 73 | inherit autotools update-rc.d systemd python3native |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 74 | |
| 75 | SYSTEMD_PACKAGES = "${PN}-switch" |
| 76 | SYSTEMD_SERVICE_${PN}-switch = " \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 77 | ovsdb-server.service \ |
| 78 | ovs-vswitchd.service \ |
| 79 | openvswitch.service \ |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 80 | " |
| 81 | |
| 82 | INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-testcontroller" |
| 83 | INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch" |
| 84 | INITSCRIPT_PARAMS_${PN}-switch = "defaults 71" |
| 85 | |
| 86 | INITSCRIPT_NAME_${PN}-testcontroller = "openvswitch-testcontroller" |
| 87 | INITSCRIPT_PARAMS_${PN}-testcontroller = "defaults 72" |
| 88 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 89 | do_configure_prepend() { |
| 90 | # Work around the for Makefile CC=$(if ....) by swapping out any |
| 91 | # "-Wa," assembly directives with "-Xassembler |
| 92 | CC=`echo '${CC}' | sed 's/-Wa,/-Xassembler /g'` |
| 93 | } |
| 94 | |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 95 | do_install_append() { |
| 96 | install -d ${D}/${sysconfdir}/default/ |
| 97 | install -m 660 ${WORKDIR}/openvswitch-switch-setup ${D}/${sysconfdir}/default/openvswitch-switch |
| 98 | install -d ${D}/${sysconfdir}/openvswitch-testcontroller |
| 99 | install -m 660 ${WORKDIR}/openvswitch-testcontroller-setup ${D}/${sysconfdir}/default/openvswitch-testcontroller |
| 100 | |
| 101 | install -d ${D}/${sysconfdir}/init.d/ |
| 102 | install -m 755 ${WORKDIR}/openvswitch-testcontroller ${D}/${sysconfdir}/init.d/openvswitch-testcontroller |
| 103 | install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch |
| 104 | true || rm -fr ${D}/${datadir}/${PN}/pki |
| 105 | |
| 106 | install -d ${D}/${systemd_unitdir}/system/ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 107 | install -m 644 ${S}/rhel/usr_lib_systemd_system_ovs-vswitchd.service \ |
| 108 | ${D}/${systemd_unitdir}/system/ovs-vswitchd.service |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 109 | install -m 644 ${S}/rhel/usr_lib_systemd_system_openvswitch.service \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 110 | ${D}/${systemd_unitdir}/system/openvswitch.service |
| 111 | install -m 644 ${S}/rhel/usr_lib_systemd_system_ovsdb-server.service \ |
| 112 | ${D}/${systemd_unitdir}/system/ovsdb-server.service |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 113 | |
| 114 | oe_runmake modules_install INSTALL_MOD_PATH=${D} |
Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 115 | install -d ${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages |
| 116 | cp -r ${S}/python/ovstest/ ${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages/ |
Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | pkg_postinst_${PN}-pki () { |
| 120 | # can't do this offline |
| 121 | if [ "x$D" != "x" ]; then |
| 122 | exit 1 |
| 123 | fi |
| 124 | if test ! -d $D/${datadir}/${PN}/pki; then |
| 125 | ovs-pki init --dir=$D/${datadir}/${PN}/pki |
| 126 | fi |
| 127 | } |
| 128 | |
| 129 | pkg_postinst_${PN}-testcontroller () { |
| 130 | # can't do this offline |
| 131 | if [ "x$D" != "x" ]; then |
| 132 | exit 1 |
| 133 | fi |
| 134 | |
| 135 | if test ! -d $D/${datadir}/${PN}/pki; then |
| 136 | ovs-pki init --dir=$D/${datadir}/${PN}/pki |
| 137 | fi |
| 138 | |
| 139 | cd $D/${sysconfdir}/openvswitch-testcontroller |
| 140 | if ! test -e cacert.pem; then |
| 141 | ln -s $D/${datadir}/${PN}/pki/switchca/cacert.pem cacert.pem |
| 142 | fi |
| 143 | if ! test -e privkey.pem || ! test -e cert.pem; then |
| 144 | oldumask=$(umask) |
| 145 | umask 077 |
| 146 | ovs-pki req+sign --dir=$D/${datadir}/${PN}/pki tmp controller >/dev/null |
| 147 | mv tmp-privkey.pem privkey.pem |
| 148 | mv tmp-cert.pem cert.pem |
| 149 | mv tmp-req.pem req.pem |
| 150 | chmod go+r cert.pem req.pem |
| 151 | umask $oldumask |
| 152 | fi |
| 153 | } |