From: Konrad Rzeszutek Wilk Date: Tue, 24 Jan 2012 04:10:32 +0000 (-0500) Subject: network-startup: Bring up only DHCP up to two interfaces - switch and ethX.. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=216580d50e82980deda18eabe32f6f1705c3d7bd;p=xentesttools%2Fbootstrap.git network-startup: Bring up only DHCP up to two interfaces - switch and ethX.. 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 5fe282d..8f2a057 100755 --- a/root_image/etc/init.d/primary_network +++ b/root_image/etc/init.d/primary_network @@ -16,6 +16,7 @@ echo "DEVICE=$NIC" > $FILE echo "ONBOOT=yes" >> $FILE echo "BRIDGE=switch" >> $FILE +COUNT=0 NICS=`ls -1 /sys/class/net/ | grep -v lo | grep -v sit` # The rest for NIC in $NICS @@ -26,7 +27,12 @@ do FILE=/etc/sysconfig/network-scripts/ifcfg-$NIC echo "DEVICE=$NIC" > $FILE echo "ONBOOT=yes" >> $FILE - echo "BOOTPROTO=dhcp" >> $FILE + echo "BOOTPROTO=dhcp" >> $FILE + COUNT=$(($COUNT+1)) + # We only want at max two DHCP interfaces. + if [ $COUNT -ge 1 ]; then + break; + fi done /etc/init.d/network start