From: Anthony Liguori Subject: Re: [Xen-changelog] Add Gentoo handling to network-bridge. Based on patches Date: Wed, 05 Oct 2005 13:09:11 -0500 Message-ID: <434416C7.9080303@us.ibm.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090505060203080905040605" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Jon Mason List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------090505060203080905040605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Keir, The network-bridge script is executed under -e so you'll either have to move the gentoo stuff before the set -e or refactor the if. Attached is a patch that moves it before the set -e since refactoring the if is gonna look pretty ugly. Regards, Anthony Liguori Xen patchbot -unstable wrote: ># HG changeset patch ># User kaf24@firebug.cl.cam.ac.uk ># Node ID e579bef0d237a12d3d52e2e61a6d48632fe61aff ># Parent e643fccb851bb5ef271057e02455661f4beff1bc >Add Gentoo handling to network-bridge. Based on patches >from Jon Mason and Anthony Liguori. > >diff -r e643fccb851b -r e579bef0d237 tools/examples/network-bridge >--- a/tools/examples/network-bridge Wed Oct 5 13:10:49 2005 >+++ b/tools/examples/network-bridge Wed Oct 5 13:14:04 2005 >@@ -54,6 +54,17 @@ > antispoof=${antispoof:-no} > > echo "*network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof" >&2 >+ >+# Gentoo doesn't have ifup/ifdown: define appropriate alternatives >+which ifup >& /dev/null >+if [ "$?" != 0 -a -e /etc/conf.d/net ]; then >+ ifup() { >+ /etc/init.d/net.$1 start >+ } >+ ifdown() { >+ /etc/init.d/net.$1 stop >+ } >+fi > > # Usage: transfer_addrs src dst > # Copy all IP addresses (including aliases) from device $src to device $dst. > >_______________________________________________ >Xen-changelog mailing list >Xen-changelog@lists.xensource.com >http://lists.xensource.com/xen-changelog > > > --------------090505060203080905040605 Content-Type: text/x-patch; name="7223_network_gentoo.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="7223_network_gentoo.diff" # HG changeset patch # User anthony@localhost.localdomain # Node ID f63d3f87db25e3cbe7309e1805a46357336e9200 # Parent 6f71824a45c19e860a3655dd8e76a83e047c84d2 Gentoo compatible stuff has to be done *before* the set -e. You could also do the which in the if with a combination of ! and || after the set -e but I think it's cleaner to just do it before the set -e. Signed-off-by: Anthony Liguori diff -r 6f71824a45c1 -r f63d3f87db25 tools/examples/network-bridge --- a/tools/examples/network-bridge Wed Oct 5 18:06:42 2005 +0100 +++ b/tools/examples/network-bridge Wed Oct 5 13:06:33 2005 -0500 @@ -38,22 +38,6 @@ # Print routes. # #============================================================================ - -# Exit if anything goes wrong. -set -e - -# First arg is the operation. -OP=$1 -shift - -# Pull variables in args in to environment. -for arg ; do export "${arg}" ; done - -bridge=${bridge:-xen-br0} -netdev=${netdev:-eth0} -antispoof=${antispoof:-no} - -echo "*network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof" >&2 # Gentoo doesn't have ifup/ifdown: define appropriate alternatives which ifup >& /dev/null @@ -65,6 +49,22 @@ /etc/init.d/net.$1 stop } fi + +# Exit if anything goes wrong. +set -e + +# First arg is the operation. +OP=$1 +shift + +# Pull variables in args in to environment. +for arg ; do export "${arg}" ; done + +bridge=${bridge:-xen-br0} +netdev=${netdev:-eth0} +antispoof=${antispoof:-no} + +echo "*network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof" >&2 # Usage: transfer_addrs src dst # Copy all IP addresses (including aliases) from device $src to device $dst. --------------090505060203080905040605 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------090505060203080905040605--