From: Konrad Rzeszutek Wilk Date: Tue, 24 Jan 2012 16:03:13 +0000 (-0500) Subject: network-setup: Make the amount of NICs that are DHCP be 3 and use a global variable... X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9c10fcff5397953034618ded883b1a33865c1fb6;p=xentesttools%2Fbootstrap.git network-setup: Make the amount of NICs that are DHCP be 3 and use a global variable for it. Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/root_image/etc/init.d/primary_network b/root_image/etc/init.d/primary_network index 37be553..596b95c 100755 --- a/root_image/etc/init.d/primary_network +++ b/root_image/etc/init.d/primary_network @@ -2,6 +2,8 @@ . /etc/init.d/functions +MAX_NICS=3 + function create_bridge() { local name=$1 @@ -24,7 +26,7 @@ function create_bridge_if() { echo "ONBOOT=yes" >> $FILE echo "BRIDGE=$name" >> $FILE - COUNT=0 + COUNT=1 NICS=`ls -1 /sys/class/net/ | grep -v lo | grep -v sit` # The rest for NIC in $NICS @@ -39,7 +41,7 @@ function create_bridge_if() { COUNT=$(($COUNT+1)) # We only want at max two DHCP interfaces. # switch and ethX - if [ $COUNT -ge 1 ]; then + if [ $COUNT -ge $MAX_NICS ]; then break; fi done @@ -57,7 +59,7 @@ function create_dhcp_if() { echo "BOOTPROTO=dhcp" >> $FILE COUNT=$(($COUNT+1)) # We only want at max two DHCP interfaces. - if [ $COUNT -ge 2 ]; then + if [ $COUNT -ge $MAX_NICS ]; then break; fi done @@ -86,7 +88,7 @@ function create_static_if() { echo "NM_CONTROLLED=no" >> $FILE COUNT=$(($COUNT+1)) # We only want at max two interfaces. - if [ $COUNT -ge 2 ]; then + if [ $COUNT -ge $MAX_NICS ]; then break; fi done