diff options
author | William Pitcock <nenolod@dereferenced.org> | 2012-09-26 02:24:03 -0500 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2012-09-26 02:24:03 -0500 |
commit | cdb36ab188ea14ae593f3a2f650540c11a201071 (patch) | |
tree | b30620c190598f1b45207180b33edb139b1f2072 | |
parent | 5bcbfc3c6506772da405c833a726894ce0848705 (diff) | |
download | aports-cdb36ab188ea14ae593f3a2f650540c11a201071.tar.bz2 aports-cdb36ab188ea14ae593f3a2f650540c11a201071.tar.xz |
testing/openvswitch: new aport
-rw-r--r-- | testing/openvswitch/APKBUILD | 72 | ||||
-rw-r--r-- | testing/openvswitch/openvswitch.post-install | 11 | ||||
-rw-r--r-- | testing/openvswitch/openvswitch.post-upgrade | 11 | ||||
-rw-r--r-- | testing/openvswitch/ovs-controller.confd | 6 | ||||
-rw-r--r-- | testing/openvswitch/ovs-controller.initd | 24 | ||||
-rw-r--r-- | testing/openvswitch/ovs-vswitchd.confd | 6 | ||||
-rw-r--r-- | testing/openvswitch/ovs-vswitchd.initd | 24 | ||||
-rw-r--r-- | testing/openvswitch/ovsdb-server.confd | 16 | ||||
-rw-r--r-- | testing/openvswitch/ovsdb-server.initd | 32 |
9 files changed, 202 insertions, 0 deletions
diff --git a/testing/openvswitch/APKBUILD b/testing/openvswitch/APKBUILD new file mode 100644 index 000000000..85ef6f8dd --- /dev/null +++ b/testing/openvswitch/APKBUILD @@ -0,0 +1,72 @@ +# Contributor: William Pitcock <nenolod@dereferenced.org> +# Maintainer: William Pitcock <nenolod@dereferenced.org> +pkgname=openvswitch +pkgver=1.7.1 +pkgrel=0 +pkgdesc="an open virtual switch" +url="http://openvswitch.org/" +arch="all" +license="GPL" +depends="" +depends_dev="openssl-dev" +depends_monitor="py-twisted py-twisted-web2 py-qt" +makedepends="$depends_dev $depends_monitor" +install="openvswitch.post-install openvswitch.post-upgrade" +subpackages="$pkgname-doc $pkgname-monitor" +source="http://openvswitch.org/releases/openvswitch-$pkgver.tar.gz + ovsdb-server.initd + ovsdb-server.confd + ovs-controller.initd + ovs-controller.confd + ovs-vswitchd.initd + ovs-vswitchd.confd" + +_builddir="$srcdir"/openvswitch-$pkgver +prepare() { + local i + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + || return 1 + make || return 1 +} + +monitor() { + depends="openvswitch $depends_monitor" + mkdir -p "$subpkgdir"/usr/share/openvswitch + mv "$pkgdir"/usr/share/openvswitch/python "$subpkgdir"/usr/share/openvswitch/python +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" install || return 1 + rm -f "$pkgdir"/usr/lib/*.la + + install -Dm755 "$srcdir"/ovsdb-server.initd "$pkgdir"/etc/init.d/ovsdb-server + install -Dm755 "$srcdir"/ovs-controller.initd "$pkgdir"/etc/init.d/ovs-controller + install -Dm755 "$srcdir"/ovs-vswitchd.initd "$pkgdir"/etc/init.d/ovs-vswitchd + + install -Dm644 "$srcdir"/ovsdb-server.confd "$pkgdir"/etc/conf.d/ovsdb-server + install -Dm644 "$srcdir"/ovs-controller.confd "$pkgdir"/etc/conf.d/ovs-controller + install -Dm644 "$srcdir"/ovs-vswitchd.confd "$pkgdir"/etc/conf.d/ovs-vswitchd +} + +md5sums="70a7076f84cdb4c0ee86c380e7f7aa78 openvswitch-1.7.1.tar.gz +8cc7f62777212fab9fc1c8c506a32e65 ovsdb-server.initd +9c2c1d774be02f2e69609bcc4f24a370 ovsdb-server.confd +4e6e5afd1dc2d3bc1043dab19cd9f61f ovs-controller.initd +0f5ce60dda512b29d4e20cb832e062d4 ovs-controller.confd +623db751bbdc390d9e9c076c0ce9a6b2 ovs-vswitchd.initd +2d1e0111ea62779f49e14d62678294b2 ovs-vswitchd.confd" diff --git a/testing/openvswitch/openvswitch.post-install b/testing/openvswitch/openvswitch.post-install new file mode 100644 index 000000000..2c3ea6937 --- /dev/null +++ b/testing/openvswitch/openvswitch.post-install @@ -0,0 +1,11 @@ +#!/bin/sh + +db="/etc/openvswitch/conf.db" +if [ -e "$db" ]; then + echo "Trying schema migration for $db..." + ovsdb-tool convert "$db" "/usr/share/openvswitch/vswitch.ovsschema" +else + echo "Creating new Open vSwitch database $db..." + ovsdb-tool create "$db" "/usr/share/openvswitch/vswitch.ovsschema" +fi + diff --git a/testing/openvswitch/openvswitch.post-upgrade b/testing/openvswitch/openvswitch.post-upgrade new file mode 100644 index 000000000..2c3ea6937 --- /dev/null +++ b/testing/openvswitch/openvswitch.post-upgrade @@ -0,0 +1,11 @@ +#!/bin/sh + +db="/etc/openvswitch/conf.db" +if [ -e "$db" ]; then + echo "Trying schema migration for $db..." + ovsdb-tool convert "$db" "/usr/share/openvswitch/vswitch.ovsschema" +else + echo "Creating new Open vSwitch database $db..." + ovsdb-tool create "$db" "/usr/share/openvswitch/vswitch.ovsschema" +fi + diff --git a/testing/openvswitch/ovs-controller.confd b/testing/openvswitch/ovs-controller.confd new file mode 100644 index 000000000..86e6c1d66 --- /dev/null +++ b/testing/openvswitch/ovs-controller.confd @@ -0,0 +1,6 @@ +# Space separated list of methods to listen for OpenFlow connections from switches +# The default is "ptcp:" which starts ovs-controller listening on port 6633 on all interfaces. +METHODS="ptcp:" + +# Additional options +# OPTIONS="" diff --git a/testing/openvswitch/ovs-controller.initd b/testing/openvswitch/ovs-controller.initd new file mode 100644 index 000000000..554aebe3f --- /dev/null +++ b/testing/openvswitch/ovs-controller.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openvswitch/files/ovs-controller,v 1.1 2012/07/18 08:41:29 dev-zero Exp $ + +depend() { + need lo +} + +start() { + checkpath -d "/var/run/openvswitch" -m 0750 + + ebegin "Starting Open vSwitch OpenFlow controller" + start-stop-daemon \ + --start --quiet --pidfile "/var/run/openvswitch/ovs-controller.pid" \ + --exec /usr/bin/ovs-controller -- --pidfile --detach --monitor ${OPTIONS} ${METHODS} + eend $? +} + +stop() { + ebegin "Stopping Open vSwitch OpenFlow controller" + start-stop-daemon --stop --quiet --pidfile "/var/run/openvswitch/ovs-controller.pid" + eend $? +} diff --git a/testing/openvswitch/ovs-vswitchd.confd b/testing/openvswitch/ovs-vswitchd.confd new file mode 100644 index 000000000..3c3d15865 --- /dev/null +++ b/testing/openvswitch/ovs-vswitchd.confd @@ -0,0 +1,6 @@ +# Connection string for the configuration database (usually a unix socket) +DATABASE="unix:/var/run/openvswitch/db.sock" + +# Additional options +OPTIONS="--mlockall" + diff --git a/testing/openvswitch/ovs-vswitchd.initd b/testing/openvswitch/ovs-vswitchd.initd new file mode 100644 index 000000000..eea20db54 --- /dev/null +++ b/testing/openvswitch/ovs-vswitchd.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openvswitch/files/ovs-vswitchd,v 1.2 2012/07/18 08:41:29 dev-zero Exp $ + +depend() { + use ovsdb-server +} + +start() { + checkpath -d "/var/run/openvswitch" -m 0750 + + ebegin "Starting Open vSwitch daemon" + start-stop-daemon \ + --start --quiet --pidfile "/var/run/openvswitch/ovs-vswitchd.pid" \ + --exec /usr/sbin/ovs-vswitchd -- --pidfile --detach --monitor ${OPTIONS} ${DATABASE} + eend $? +} + +stop() { + ebegin "Stopping Open vSwitch daemon" + start-stop-daemon --stop --quiet --pidfile "/var/run/openvswitch/ovs-vswitchd.pid" + eend $? +} diff --git a/testing/openvswitch/ovsdb-server.confd b/testing/openvswitch/ovsdb-server.confd new file mode 100644 index 000000000..1299b8206 --- /dev/null +++ b/testing/openvswitch/ovsdb-server.confd @@ -0,0 +1,16 @@ +# Socket for bringing the server up +DB_SOCKET="/var/run/openvswitch/db.sock" + +# Remote sockets are defined in the database by default +REMOTE_DB="db:Open_vSwitch,manager_options" + +# All certificates and keys are stored in the database (if any) +PRIVATE_KEY="db:SSL,private_key" +CERTIFICATE="db:SSL,certificate" +BOOTSTRAP_CA_CERT="db:SSL,ca_cert" + +# Alternative path for the database (default is /etc/openvswitch/conf.db) +# DATABASE="/etc/openvswitch/conf.db" + +# Additional options +# OPTIONS="" diff --git a/testing/openvswitch/ovsdb-server.initd b/testing/openvswitch/ovsdb-server.initd new file mode 100644 index 000000000..5eb5daf34 --- /dev/null +++ b/testing/openvswitch/ovsdb-server.initd @@ -0,0 +1,32 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openvswitch/files/ovsdb-server,v 1.1 2012/06/27 08:49:34 dev-zero Exp $ + +depend() { + need localmount +} + +start() { + checkpath -d "/var/run/openvswitch" -m 0750 + + local remote_punix=${DB_SOCKET:+"--remote=punix:${DB_SOCKET}"} + local remote_db=${REMOTE_DB:+"--remote=${REMOTE_DB}"} + local private_key=${PRIVATE_KEY:+"--private-key=${PRIVATE_KEY}"} + local certificate=${CERTIFICATE:+"--certificate=${CERTIFICATE}"} + local bootstrap_ca_cert=${BOOTSTRAP_CA_CERT:+"--bootstrap-ca-cert=${BOOTSTRAP_CA_CERT}"} + + ebegin "Starting Open vSwitch DB server" + start-stop-daemon \ + --start --quiet \ + --pidfile "/var/run/openvswitch/ovsdb-server.pid" \ + --exec /usr/sbin/ovsdb-server -- --pidfile --detach --monitor ${remote_punix} ${remote_db} ${private_key} ${certificate} ${bootstrap_ca_cert} ${DATABASE} ${OPTIONS} + eend $? +} + +stop() { + ebegin "Stopping Open vSwitch DB server" + start-stop-daemon --stop --quiet --pidfile "/var/run/openvswitch/ovsdb-server.pid" + eend $? +} + |