~alpine/devel

/testing/openvswitch - revised init scripts / mainline module v1 PROPOSED

Stuart Cardall: 1
 /testing/openvswitch - revised init scripts / mainline module

 8 files changed, 58 insertions(+), 203 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/devel/patches/796/mbox | git am -3
Learn more about email & git

[alpine-devel] [PATCH] /testing/openvswitch - revised init scripts / mainline module Export this patch

Removed separate kernel module package & moved it's init script into openvswitch
so the mainline openvswitch module is used.

Removed ovs-controller as it's no longer installed by default in current git.

Revised init scripts so ovs-modules / ovsdb-server / ovs-vswitchd all start before
networking in the correct order. LXC Guests now autostart correctly.
---
 testing/openvswitch-grsec/APKBUILD                 | 95 ----------------------
 .../openvswitch-grsec/openvswitch-modules.initd    | 25 ------
 testing/openvswitch/APKBUILD                       | 72 ++++++----------
 testing/openvswitch/ovs-controller.confd           |  6 --
 testing/openvswitch/ovs-controller.initd           | 28 -------
 testing/openvswitch/ovs-modules.initd              | 25 ++++++
 testing/openvswitch/ovs-vswitchd.initd             |  6 +-
 testing/openvswitch/ovsdb-server.initd             |  4 +-
 8 files changed, 58 insertions(+), 203 deletions(-)
 delete mode 100644 testing/openvswitch-grsec/APKBUILD
 delete mode 100644 testing/openvswitch-grsec/openvswitch-modules.initd
 delete mode 100644 testing/openvswitch/ovs-controller.confd
 delete mode 100644 testing/openvswitch/ovs-controller.initd
 create mode 100644 testing/openvswitch/ovs-modules.initd

diff --git a/testing/openvswitch-grsec/APKBUILD b/testing/openvswitch-grsec/APKBUILD
deleted file mode 100644
index fc4c580..0000000
--- a/testing/openvswitch-grsec/APKBUILD
@@ -1,95 +0,0 @@
# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>

_flavor=grsec
_kpkg=linux-$_flavor
_realname=openvswitch
_kver=3.10.28
_kpkgrel=0

_realver=2.0.1
_gitversion=09350a3de320e83517c943858acc397db784d583
_ver=${_gitversion:0:7}
_mypkgrel=0

# source openvswitch version
if [ -f ../testing/$_realname/APKBUILD ]; then
	. ../testing/$_realname/APKBUILD
	[ "${_gitversion}" != "$gitversion" ] && pkgname=$_realname-$_flavor \
		&& die "please set _gitversion to $gitversion"
fi

# source the kernel version
if [ -f ../testing/linux-${_flavor}-openvswitch/APKBUILD ]; then
        . ../testing/linux-${_flavor}-openvswitch/APKBUILD
	[ "$_kver" != "$pkgver" ] && die "_kver=$_kver pkgver=$pkgver - please set _kver to $pkgver"
	[ "$_kpkgrel" != "$pkgrel" ] && die "please set _kpkgrel to $pkgrel"
fi

_abi_release=${_kver}-${_kpkgrel}-${_flavor}
_kernelver="$_kver-r$_kpkgrel"

pkgname="$_realname-$_flavor"
pkgver=$_kver
pkgrel=$(($_kpkgrel + $_mypkgrel))

pkgdesc="A production quality, multilayer virtual switch - this package contains the Kernel Module."
url="http://openvswitch.org/"
arch="all"
license="Apache 2.0"
subpackages=""
depends="linux-${_flavor}=${_kernelver}"
depends_dev="openssl-dev linux-${_flavor}-dev=${_kernelver}"
makedepends="$depends_dev"
source="saveas-http://git.openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=snapshot;h=$_gitversion;sf=tgz/$pkgname-$_realver+git$gitdate.tar.gz
	openvswitch-modules.initd
	"
install_if="linux-${_flavor}-openvswitch=${_kernelver} openvswitch2"

_builddir="$srcdir"/$_realname-$_ver

prepare() {
	cd "$_builddir"
	update_config_sub || return 1
        for i in $source; do
                case $i in
                *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
                esac
        done
}

build() {
	export GCC_SPECS=hardenednopie.specs
	cd "$_builddir"
	./boot.sh \
        ./configure # must be run twice to generate & update makefile or build fails
        ./configure --prefix=/usr \
                --sysconfdir=/etc \
                --mandir=/usr/share/man \
                --infodir=/usr/share/info \
                --localstatedir=/var \
                --enable-ndebug \
                --with-linux=/lib/modules/$_abi_release/build \
		--with-linux-source=/usr/src/linux-headers-${_abi_release} \
                || return 1
	cd "$_builddir"/datapath
        make -j1 CONFIG_DEBUG_SECTION_MISMATCH=y || return 1
}

package() {
	cd "$_builddir"
	install -D -m755 "$srcdir"/openvswitch-modules.initd \
		"$pkgdir"/etc/init.d/openvswitch-modules-${_flavor} || return 1
	mkdir -p $pkgdir/lib/modules/${_abi_release}/kernel/net/openvswitch
	cd "$_builddir"/datapath/linux
	for module in `find . -type f -name '*.ko'`; do
		install -Dm644 $module "$pkgdir/lib/modules/${_abi_release}/kernel/net/openvswitch/"
	done
}

md5sums="4e9384ddbd8dbb40ad899fd089f335d7  openvswitch-grsec-2.0.1+git.tar.gz
f358118b571348c781fa9d24dc14e876  openvswitch-modules.initd"
sha256sums="015d801240c0eae44cc8507e36abf76dbf8919925352eedab0d2d0db8cdc140b  openvswitch-grsec-2.0.1+git.tar.gz
6e999b2e0a93a4fa5268361f98f59a6c527266c6d5ae9dc593a5cad488a300a3  openvswitch-modules.initd"
sha512sums="bc9b964db5e25572b0034330f34b65bd40d3f294d35e1b7522f1339c3e0b4200581fbd1b5cf13f2632c9b19315ce669387833d6f24e139c6ad61e17b8fe4afb7  openvswitch-grsec-2.0.1+git.tar.gz
d69cc29e7c4e8278b77fd8f03d635f109a14ee0c4fbfc25635f3ca2fd2f59d4664188743cb5f7273891b25a61d43192c5f448e41f7c606d6a5b9050314f14151  openvswitch-modules.initd"
diff --git a/testing/openvswitch-grsec/openvswitch-modules.initd b/testing/openvswitch-grsec/openvswitch-modules.initd
deleted file mode 100644
index 8e48d1e..0000000
--- a/testing/openvswitch-grsec/openvswitch-modules.initd
@@ -1,25 +0,0 @@
#!/sbin/runscript

MODULES="openvswitch"

depend() {
        before openvswitch
}


start() {
        ebegin "Loading Openvswitch kernel modules"
        for mod in $MODULES; do
		modprobe -q $mod
	done
	eend $?
}

stop() {
        ebegin "Unloading Openvswitch kernel modules"
        for mod in $MODULES; do
		rmmod $mod
	done
        eend $?
}

diff --git a/testing/openvswitch/APKBUILD b/testing/openvswitch/APKBUILD
index 3011da7..2ca422e 100644
--- a/testing/openvswitch/APKBUILD
+++ b/testing/openvswitch/APKBUILD
@@ -2,13 +2,7 @@
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=openvswitch
pkgver=2.0.1
gitdate=141213
gitversion=f9b9c7a68dc4c5eefb100b8b4d0e024b5ce87f2a
f9b9c7a68dc4c5eefb100b8b4d0e024b5ce87f2a
pkgrel=1
_kver=3.10.28
_kpkgrel=0
_flavor=grsec
pkgrel=2
pkgdesc="A production quality, multilayer virtual switch - includes Kernel Modules for best performance."
url="http://openvswitch.org/"
arch="all"
@@ -16,25 +10,22 @@ license="GPL"
depends=""
depends_dev="openssl-dev"
depends_monitor="py-twisted py-twisted-web2 py-qt"
makedepends="linux-grsec-dev perl $depends_dev $depends_monitor"
makedepends="perl $depends_dev $depends_monitor"
install="openvswitch.post-install openvswitch.post-upgrade"
subpackages="$pkgname-doc $pkgname-monitor"
source="saveas-http://git.openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=snapshot;h=$gitversion;sf=tgz/$pkgname-$pkgver+git$gitdate.tar.gz
source="http://openvswitch.org/releases/$pkgname-$pkgver.tar.gz
	ovsdb-server.initd
	ovsdb-server.confd
	ovs-controller.initd
	ovs-controller.confd
	ovs-vswitchd.initd
	ovs-vswitchd.confd"
	ovs-vswitchd.confd
	ovs-modules.initd"

_builddir="$srcdir"/$pkgname-${gitversion:0:7}
_abi_release=${_kver}-${_kpkgrel}-${_flavor}
_kernelver="$_kver-r$_kpkgrel"
builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	local i
        cd "$_builddir"
	#patch not needed after git-180214 https://www.mail-archive.com/dev@openvswitch.org/msg25840.html
        cd "$builddir"
	#patch not needed after v2.0.1 https://www.mail-archive.com/dev@openvswitch.org/msg25840.html
	patch -p1 -i ../../remove-test-atomic-8byte.patch || return 1

        for i in $source; do
@@ -42,14 +33,10 @@ prepare() {
                *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
                esac
        done

	if [ ! -d /usr/src/linux-headers-$_abi_release ]; then
		echo "linux-grsec-dev-$_kernelver not found"; return 1
	fi
}

build() {
	cd "$_builddir"
	cd "$builddir"
	./boot.sh \
	./configure # must be run twice to generate & update makefile or build fails
	./configure --prefix=/usr \
@@ -58,8 +45,6 @@ build() {
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-ndebug \
		--with-linux=/lib/modules/$_abi_release/build \
		--with-linux-source=/usr/src/linux-headers-$_abi_release \
		|| return 1
	make CONFIG_DEBUG_SECTION_MISMATCH=y || return 1
}
@@ -71,38 +56,33 @@ monitor() {
}

package() {
	cd "$_builddir"
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1
	rm -f "$pkgdir"/usr/lib/*.la
	rm -f "$pkgdir"/usr/lib/*.a

	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 -Dm755 "$srcdir"/ovs-modules.initd "$pkgdir"/etc/init.d/ovs-modules
	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="f29b6c789a14cf7b9f2aa4b34bd6a5f5  openvswitch-2.0.1+git141213.tar.gz
b9b6b23d349d5563d70a1c6d0a5b677c  ovsdb-server.initd
md5sums="a2122b1c293c8d05dc0c673d42a9da08  openvswitch-2.0.1.tar.gz
464eafc0e07aada01495470f5f816f36  ovsdb-server.initd
f10a8ac784654bec359bda52779f16fe  ovsdb-server.confd
488dffc27afbc48cebf140019ae05818  ovs-controller.initd
0f5ce60dda512b29d4e20cb832e062d4  ovs-controller.confd
737a852ef4590c42f4548313a3fc97f2  ovs-vswitchd.initd
2d1e0111ea62779f49e14d62678294b2  ovs-vswitchd.confd"
sha256sums="4514672b669afa2f2ec0f95280224109e98d8a4b4b1654b34e6cf5c519b0eb27  openvswitch-2.0.1+git141213.tar.gz
2a9a3bd0277362fcdab62b7ea86ae2e488e099d9ed724dc27648136e5f5ed93c  ovsdb-server.initd
003297c9ec93877508812332101c2bf5  ovs-vswitchd.initd
2d1e0111ea62779f49e14d62678294b2  ovs-vswitchd.confd
ae128e5c349710c0fb3849b2d3b3aa40  ovs-modules.initd"
sha256sums="014907bcf2f98228dfa4472ea1547871d24b8fb8192dcfff3ead1af93c433a67  openvswitch-2.0.1.tar.gz
b58a4bdab9ca035a9271067edadb19598985c55820f020d8aefe71b516a3e7f6  ovsdb-server.initd
d0d8a6a7256f4cc47ab1b9f9f7657202388133bcfff3668e7c1d4adbcc572261  ovsdb-server.confd
f1a89f8cb42e18bb8ba7a184a6cdecaa30164ecb1aaa3115b729cc338b6316ca  ovs-controller.initd
950996914d7991550ead5fcfb5b262c60b5f53df6796c111105baa2a89a39431  ovs-controller.confd
467ee6110748046e29e4e92e0b7bf11b9c083c252dfb0d901ce2879a1726a734  ovs-vswitchd.initd
cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a  ovs-vswitchd.confd"
sha512sums="e851c6e923ae92b0f265e14fabb98b034c9221f9953fbdb90081531f8790ef7c2b7d4f52a5144f68489e360206ba3283f1400a09533c52d4320f5b7e73fc5377  openvswitch-2.0.1+git141213.tar.gz
4d031347b146cf82812cb0fc1ead944d6e29a9a8bd2afe603c4003b6f8c9d2f9d0c5f7e2ebdad456e7f5af4b01c756203cd96cc44db7be266bf94ac9bba188ff  ovsdb-server.initd
591d8c10080ba2fa2ddf5bf8da281d931421c95ff728f56fbaa10be7c3d8431c  ovs-vswitchd.initd
cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a  ovs-vswitchd.confd
94f4dba5e2ddedb9c91911b02dbfc41a5114e8a5066a8db3ef4444ebb5400173  ovs-modules.initd"
sha512sums="4207cac887c9e2dad234d1e2b70d5309e51b8d10dbe994f125ff9e967935f3674574651c9fb297cf59dbc355830f2947cd98e4f5d28aaf495b9b950a9f603eeb  openvswitch-2.0.1.tar.gz
6d660c986666b3f3b052d5ff6a8555c8bf5234fee8c4740d70974b1ac00ee2a0711e931494556290e18fce820ce8f2d4a5f25e40e9c863da9b639c18c0515763  ovsdb-server.initd
b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7f6d32916853190336cfe3735f672ad7cb624ae14dbff55a5  ovsdb-server.confd
feab263b4a4305d6b21dc29c5c29dc43813b37adccaefc4fd74412a8a03f0c00dfa6dff7f88934e5e7c05d44ad36647c212d3ba46736b27116df22f4d9e9925e  ovs-controller.initd
e8f28b01a080d4ba11db7f17e61d4352241194e723fc198cc1c7ce60717be297025b892633599be3e1dc86dec525c1be41b9f22a5c06b8a4c267555195c92dc9  ovs-controller.confd
543f82887e374e25d703d968cca90bf36603ea23dd9a8b4e5bc6181d95402e6b47b28c0e079f516639542b87a43458b929f0db9104faaa68016c9410d152636b  ovs-vswitchd.initd
346aea099f51707d2b4fc9fdc8c1502582723fb4e00c4d5d1624b0378c94dfb76674fa95e2af894f36169df52109dbe441ee6a45aa744584d9e4c74d15a46c1d  ovs-vswitchd.confd"
3d493047a6729b7e0742438de828a2530acbcdac9c1c410786bf1eefb5e9f09850fb479f45245f550d1077146d4545fb91a845ae79f673b6c1c2902220920e33  ovs-vswitchd.initd
346aea099f51707d2b4fc9fdc8c1502582723fb4e00c4d5d1624b0378c94dfb76674fa95e2af894f36169df52109dbe441ee6a45aa744584d9e4c74d15a46c1d  ovs-vswitchd.confd
e1f88ff11cd1d5a4025626acad49411e8a2d5d7caa20d0a63ef0422a9b1bb55b070843327d8bb209e1e915d2a3f1c3bcae911acf40e0a419bc6cce6250239232  ovs-modules.initd"
diff --git a/testing/openvswitch/ovs-controller.confd b/testing/openvswitch/ovs-controller.confd
deleted file mode 100644
index 86e6c1d..0000000
--- a/testing/openvswitch/ovs-controller.confd
@@ -1,6 +0,0 @@
# 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
deleted file mode 100644
index 5f07636..0000000
--- a/testing/openvswitch/ovs-controller.initd
@@ -1,28 +0,0 @@
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/openvswitch/files/ovs-controller-r1,v 1.1 2013/04/08 19:37:58 dev-zero Exp $

description="Open vSwitch OpenFlow controller"

# in the 2.1 release ovs-controller has been renamed test-controller.  It is no longer
# packaged or installed by default, because too many users assumed incorrectly that
# ovs-controller was a necessary or desirable part of an Open vSwitch deployment.
# (!!!! SO YOU PROBABLY DO NOT WANT TO USE THIS !!!!)

command="/usr/bin/ovs-controller"
command_args="
    --pidfile
    --detach
    --monitor
    ${OPTIONS} ${METHODS}"
pidfile="/var/run/openvswitch/ovs-controller.pid"

depend() {
    need net
    use logger
}

start_pre() {
	checkpath -d "/var/run/openvswitch" -m 0750
}
diff --git a/testing/openvswitch/ovs-modules.initd b/testing/openvswitch/ovs-modules.initd
new file mode 100644
index 0000000..204348d
--- /dev/null
+++ b/testing/openvswitch/ovs-modules.initd
@@ -0,0 +1,25 @@
#!/sbin/runscript

MODULES="openvswitch"

depend() {
        before ovsdb-server
}


start() {
        ebegin "Loading Openvswitch kernel modules"
        for mod in $MODULES; do
		modprobe -q $mod
	done
	eend $?
}

stop() {
        ebegin "Unloading Openvswitch kernel modules"
        for mod in $MODULES; do
		rmmod $mod
	done
        eend $?
}

diff --git a/testing/openvswitch/ovs-vswitchd.initd b/testing/openvswitch/ovs-vswitchd.initd
index 3f14cc9..debdf61 100644
--- a/testing/openvswitch/ovs-vswitchd.initd
+++ b/testing/openvswitch/ovs-vswitchd.initd
@@ -14,8 +14,10 @@ command_args="
pidfile="/var/run/openvswitch/ovs-vswitchd.pid"

depend() {
	use logger
	need ovsdb-server
        need localmount ovsdb-server
        after bootmisc hwdrivers modules
        before net
    use logger
}

start_pre() {
diff --git a/testing/openvswitch/ovsdb-server.initd b/testing/openvswitch/ovsdb-server.initd
index a7d7c02..e369da3 100644
--- a/testing/openvswitch/ovsdb-server.initd
+++ b/testing/openvswitch/ovsdb-server.initd
@@ -26,7 +26,9 @@ command_args="
pidfile="/var/run/openvswitch/ovsdb-server.pid"

depend() {
	need localmount
        need localmount ovsdb-server
        after bootmisc hwdrivers modules
        before net
    use logger
}

-- 
1.8.5.4



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---