Subject: [alpine-aports] [PATCH] main/openvswitch: fix ifupdown script

From: Stuart Cardall <[email-masked]>
Date: Mon, 17 Aug 2015 22:39:22 +0000

starting ovs-vswitchd from the ifupdown script did not start the depends
during boot.

ovs will now start correctly with networking if it is stopped or if none
of the ovs services have been configured.
---
 main/openvswitch/APKBUILD              |  8 ++++----
 main/openvswitch/ifupdown-alpine.patch | 22 ++++++++++++----------
 main/openvswitch/ifupdown.sh           | 12 +++++++-----
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/main/openvswitch/APKBUILD b/main/openvswitch/APKBUILD
index 940304c..c89d3ab 100644
--- a/main/openvswitch/APKBUILD
+++ b/main/openvswitch/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Stuart Cardall <[email-masked]>
 pkgname=openvswitch
 pkgver=2.3.2
-pkgrel=1
+pkgrel=2
 pkgdesc="A production quality, multilayer virtual switch"
 url="http://openvswitch.org/"
 arch="all"
@@ -92,7 +92,7 @@ f10a8ac784654bec359bda52779f16fe  ovsdb-server.confd
 45b381d434ccbc634a3224c5963edc66  ovs-modules.initd
 6e17032bd6e7caf6e6e844b5a84d7080  musl-if_packet.patch
 59fa9a6d293a25571562a5190ae559f2  0001-ovs-thread-Set-stacksize-to-1M.patch
-b8c688a31385dc4e19f12799546a8a8e  ifupdown-alpine.patch
+85d556990605747b2e5ddf782e2406db  ifupdown-alpine.patch
 7280528282e3c9ec235e013fede2f973  readme.debian.patch"
 sha256sums="386b11df94d06c68d391ee4091832360095bd3a14c72d454325fab284dad9887  openvswitch-2.3.2.tar.gz
 737be74a4ce951cd49b9cd85696ff5cbdb54fa7ad52c831494fcf336487fc420  ovsdb-server.initd
@@ -102,7 +102,7 @@ cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a  ovs-vswitchd.c
 06079771a94dd363218f2b3561efd0178a47d85bfd73c8b6cf24eef4ec82b0de  ovs-modules.initd
 d0e9e3e30b2943b10e7efa59c41c3bf8d5b599d55fc99198146bf4761df4d8ae  musl-if_packet.patch
 faf997814e89b0b5948c06050ef38051f0bc6b108958f76313263f77a724906c  0001-ovs-thread-Set-stacksize-to-1M.patch
-8554e7272818471fb12d633132e2e51ea31199a5d4559e2c098af48ab089b0de  ifupdown-alpine.patch
+ac312e42b5d47137f860091ad041e7486107ba7956d37cd5a5c91893f7b8a3b3  ifupdown-alpine.patch
 57a2becc7210faff2fb57ef51f8e6c33978925b48e013ba5fb78d031f2f55748  readme.debian.patch"
 sha512sums="dfbd9d5b16aeecdc880efb910e0ec2e474dcc02515f0033b1e9466735387b39f2855bec49936a261aea66badb35e09598dbb9fc4b506e9a9e0c18d3441fea691  openvswitch-2.3.2.tar.gz
 097d4721a78fff749c534910d98543778474406bd61b469b88a0d981a2a380556444437ec44278cead6d8688c45a38b2acbf1551acb9ab38d048f413728e3b88  ovsdb-server.initd
@@ -112,5 +112,5 @@ b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7
 614c86eab826bb8f934cf4a98508fde9952a0b7211414e074510473af3455077a333729aa0e59f3634b9bf30d64847d0f7597246506c36a8f09d57573a2522fc  ovs-modules.initd
 1ebfb2629081cc0b34383e6c2f163f3c1d43da3a399b8ba8745871b77029d3b8fc21a287ff859a6a9cca2cb4885715458d4e4086cb6c17765ff7c898d4004850  musl-if_packet.patch
 5fed04e68b58ab322154fa1cc4c4b63b08c22ed41f0b7713dbe8437f7cb4e9fd93c8aba524c2e5a46bba956da9439f5bfe5ba6fcdff2b98fa9bbcc748c5b64db  0001-ovs-thread-Set-stacksize-to-1M.patch
-45c793e1fd303a2a234abdb99c07a5dac14261a216e3f250f50488dba7114771372225c18f9f1469344e040e1b51dec513d423323dce6af4077757c22f3330d9  ifupdown-alpine.patch
+0f2847986783f020f0708f2b185f10d1d34ead679bcae553a42df34a244c815e6e7346a2d73af69aff86258ecb3c855630a99ec28c6c7567bcfeacfb5379e5ee  ifupdown-alpine.patch
 27bf10138b0be024c0a9039aea9cfa42825d365de5d414872b25d7cd642f2d0d41d5c604d5282362f3d2b1782513fc792a619fe0b6de19d14c04178e11a3ccb0  readme.debian.patch"
diff --git a/main/openvswitch/ifupdown-alpine.patch b/main/openvswitch/ifupdown-alpine.patch
index a417f72..d9c0d89 100644
--- a/main/openvswitch/ifupdown-alpine.patch
+++ b/main/openvswitch/ifupdown-alpine.patch
@@ -1,27 +1,29 @@
---- ./debian/ifupdown.sh.orig
-+++ ./debian/ifupdown.sh
-@@ -29,8 +29,8 @@ if (ovs_vsctl --version) > /dev/null 2>&
+--- openvswitch-2.3.2/debian/ifupdown.sh	2015-06-18 19:32:47.000000000 +0000
++++ openvswitch-2.3.2/debian/ifupdown.sh.new	2015-08-17 15:56:59.703461309 +0000
+@@ -29,8 +29,10 @@ if (ovs_vsctl --version) > /dev/null 2>&
      exit 0
  fi
  
 -if /etc/init.d/openvswitch-switch status > /dev/null 2>&1; then :; else
 -    /etc/init.d/openvswitch-switch start
 +if ! /etc/init.d/ovs-vswitchd status &>/dev/null; then
++    /etc/init.d/ovs-modules start
++    /etc/init.d/ovsdb-server start
 +    /etc/init.d/ovs-vswitchd start
  fi
  
  if [ "${MODE}" = "start" ]; then
-@@ -38,7 +38,8 @@
+@@ -42,7 +44,8 @@ if [ "${MODE}" = "start" ]; then
                           ${OVS_EXTRA+-- $OVS_EXTRA}
  
                  if [ ! -z "${IF_OVS_PORTS}" ]; then
 -                    ifup --allow="${IFACE}" ${IF_OVS_PORTS}
-+#                    ifup --allow="${IFACE}" ${IF_OVS_PORTS}
-+                    ifup  ${IF_OVS_PORTS}
++#                   ifup --allow="${IFACE}" ${IF_OVS_PORTS}
++                    ifup ${IF_OVS_PORTS}
                  fi
                  ;;
          OVSPort)
-@@ -46,24 +47,24 @@
+@@ -50,24 +53,24 @@ if [ "${MODE}" = "start" ]; then
                      "${IFACE}" ${IF_OVS_OPTIONS} \
                      ${OVS_EXTRA+-- $OVS_EXTRA}
  
@@ -34,7 +36,7 @@
                      type=internal ${OVS_EXTRA+-- $OVS_EXTRA}
  
 -                ifconfig "${IFACE}" up
-+		ip link set dev "${IFACE}" up
++                ip link set dev "${IFACE}" up
                  ;;
          OVSBond)
                  ovs_vsctl -- --fake-iface add-bond "${IF_OVS_BRIDGE}"\
@@ -50,12 +52,12 @@
                  done
                  ;;
          OVSTunnel)
-@@ -80,7 +81,8 @@
+@@ -84,7 +87,8 @@ elif [ "${MODE}" = "stop" ]; then
      case "${IF_OVS_TYPE}" in
          OVSBridge)
                  if [ ! -z "${IF_OVS_PORTS}" ]; then
 -                    ifdown --allow="${IFACE}" ${IF_OVS_PORTS}
-+#                    ifdown --allow="${IFACE}" ${IF_OVS_PORTS}
++#                   ifdown --allow="${IFACE}" ${IF_OVS_PORTS}
 +                    ifdown ${IF_OVS_PORTS}
                  fi
  
diff --git a/main/openvswitch/ifupdown.sh b/main/openvswitch/ifupdown.sh
index a2bd048..c6f4366 100755
--- a/main/openvswitch/ifupdown.sh
+++ b/main/openvswitch/ifupdown.sh
@@ -29,7 +29,9 @@ if (ovs_vsctl --version) > /dev/null 2>&1; then :; else
     exit 0
 fi
 
-if /etc/init.d/ovs-vswitchd status > /dev/null 2>&1; then :; else
+if ! /etc/init.d/ovs-vswitchd status &>/dev/null; then
+    /etc/init.d/ovs-modules start
+    /etc/init.d/ovsdb-server start
     /etc/init.d/ovs-vswitchd start
 fi
 
@@ -42,8 +44,8 @@ if [ "${MODE}" = "start" ]; then
                          ${OVS_EXTRA+-- $OVS_EXTRA}
 
                 if [ ! -z "${IF_OVS_PORTS}" ]; then
-#                    ifup --allow="${IFACE}" ${IF_OVS_PORTS}
-                    ifup  ${IF_OVS_PORTS}
+#                   ifup --allow="${IFACE}" ${IF_OVS_PORTS}
+                    ifup ${IF_OVS_PORTS}
                 fi
                 ;;
         OVSPort)
@@ -58,7 +60,7 @@ if [ "${MODE}" = "start" ]; then
                     "${IFACE}" ${IF_OVS_OPTIONS} -- set Interface "${IFACE}"\
                     type=internal ${OVS_EXTRA+-- $OVS_EXTRA}
 
-		ip link set dev "${IFACE}" up
+                ip link set dev "${IFACE}" up
                 ;;
         OVSBond)
                 ovs_vsctl -- --fake-iface add-bond "${IF_OVS_BRIDGE}"\
@@ -85,7 +87,7 @@ elif [ "${MODE}" = "stop" ]; then
     case "${IF_OVS_TYPE}" in
         OVSBridge)
                 if [ ! -z "${IF_OVS_PORTS}" ]; then
-#                    ifdown --allow="${IFACE}" ${IF_OVS_PORTS}
+#                   ifdown --allow="${IFACE}" ${IF_OVS_PORTS}
                     ifdown ${IF_OVS_PORTS}
                 fi
 
-- 
2.5.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---