[SCM] live-boot branch, debian-next, updated. debian/3.0_a1-1-3-g413bb58

Daniel Baumann daniel at debian.org
Wed Aug 18 12:32:04 UTC 2010


The following commit has been merged in the debian-next branch:
commit 413bb58225c11efd3c0c453007d2f2d79af71c77
Author: Steven Shiau <steven at nchc.org.tw>
Date:   Wed Aug 18 14:30:06 2010 +0200

    Making multiple connected NICs work.

diff --git a/scripts/live b/scripts/live
index 2976dae..07226fa 100755
--- a/scripts/live
+++ b/scripts/live
@@ -581,6 +581,9 @@ do_netsetup ()
 	udevadm trigger
 	udevadm settle
 
+	[ -n "$ETHDEV_TIMEOUT" ] || ETHDEV_TIMEOUT=15
+	echo "Using timeout of $ETHDEV_TIMEOUT seconds for network configuration."
+
 	if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && \
 	   [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ]
 	then
@@ -651,9 +654,6 @@ do_netsetup ()
 		devlist="$devlist $device"
 	done
 
-	[ -n "$ETHDEV_TIMEOUT" ] || ETHDEV_TIMEOUT=15
-	echo "Using timeout of $ETHDEV_TIMEOUT seconds for network configuration."
-
 	# this is tricky (and ugly) because ipconfig sometimes just hangs/runs into
 	# an endless loop; iff execution fails give it two further tries, that's
 	# why we use '$devlist $devlist $devlist' for the other for loop
@@ -677,45 +677,54 @@ do_netsetup ()
 	done
 
 	else
-	ipconfig ${DEVICE} | tee /netboot.config
-	fi
-
-	# source relevant ipconfig output
-	OLDHOSTNAME=${HOSTNAME}
-	. /tmp/net-${DEVICE}.conf
-	[ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
-	export HOSTNAME
-
-	if [ -n "${DEVICE}" ]
-	then
-		HWADDR="$(cat /sys/class/net/${DEVICE}/address)"
+		for interface in ${DEVICE}; do
+			ipconfig -t "$ETHDEV_TIMEOUT" ${interface} | tee /netboot-${interface}.config
+			[ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf
+			if [ "$IPV4ADDR" != "0.0.0.0" ]
+			then
+				break
+			fi
+		done
 	fi
 
-	if [ ! -e "/etc/resolv.conf" ]
-	then
-		echo "Creating /etc/resolv.conf"
+	for interface in ${DEVICE}; do
+		# source relevant ipconfig output
+		OLDHOSTNAME=${HOSTNAME}
+		[ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf
+		[ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
+		export HOSTNAME
 
-		if [ -n "${DNSDOMAIN}" ]
+		if [ -n "${interface}" ]
 		then
-			echo "domain ${DNSDOMAIN}" > /etc/resolv.conf
-			echo "search ${DNSDOMAIN}" > /etc/resolv.conf
+			HWADDR="$(cat /sys/class/net/${interface}/address)"
 		fi
 
-		for i in ${IPV4DNS0} ${IPV4DNS1} ${IPV4DNS1}
-		do
-			echo "nameserver $i" >> /etc/resolv.conf
-		done
-	fi
+		if [ ! -e "/etc/resolv.conf" ]
+		then
+			echo "Creating /etc/resolv.conf"
 
-	# Check if we have a network device at all
-	if ! ls /sys/class/net/"$DEVICE" > /dev/null 2>&1 && \
-	   ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
-	   ! ls /sys/class/net/wlan0 > /dev/null 2>&1 && \
-	   ! ls /sys/class/net/ath0 > /dev/null 2>&1 && \
-	   ! ls /sys/class/net/ra0 > /dev/null 2>&1
-	then
-		panic "No supported network device found, maybe a non-mainline driver is required."
-	fi
+			if [ -n "${DNSDOMAIN}" ]
+			then
+				echo "domain ${DNSDOMAIN}" > /etc/resolv.conf
+				echo "search ${DNSDOMAIN}" > /etc/resolv.conf
+			fi
+
+			for i in ${IPV4DNS0} ${IPV4DNS1} ${IPV4DNS1}
+			do
+				echo "nameserver $i" >> /etc/resolv.conf
+			done
+		fi
+
+		# Check if we have a network device at all
+		if ! ls /sys/class/net/"$interface" > /dev/null 2>&1 && \
+		   ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
+		   ! ls /sys/class/net/wlan0 > /dev/null 2>&1 && \
+		   ! ls /sys/class/net/ath0 > /dev/null 2>&1 && \
+		   ! ls /sys/class/net/ra0 > /dev/null 2>&1
+		then
+			panic "No supported network device found, maybe a non-mainline driver is required."
+		fi
+	done
 }
 
 do_netmount()
diff --git a/scripts/live-premount/select_eth_device b/scripts/live-premount/select_eth_device
index dfeac3d..fe86313 100755
--- a/scripts/live-premount/select_eth_device
+++ b/scripts/live-premount/select_eth_device
@@ -68,6 +68,7 @@ for ARGUMENT in $(cat /proc/cmdline); do
     esac
 done
 
+found_eth_dev=""
 while true; do
 	echo -n "Looking for a connected Ethernet interface ..."
 
@@ -85,13 +86,17 @@ while true; do
 				2>/dev/null)
 			# link detected
 			if [ "$carrier" = 1 ]; then
-				echo " found $interface."
+				echo "Connected $interface found"
 				# inform initrd's init script :
-				echo "DEVICE=$interface" >> /conf/param.conf
-				exit 0
+				found_eth_dev="$found_eth_dev $interface"
 			fi
 		done
-		# wait a bit
-		sleep 1
+		if [ -n "$found_eth_dev" ]; then
+			echo "DEVICE='$found_eth_dev'" >> /conf/param.conf
+			exit 0
+		else
+			# wait a bit
+			sleep 1
+		fi
 	done
 done

-- 
live-boot



More information about the debian-live-changes mailing list