5 # Boot type in initramfs's config
6 bootconf=$(egrep '^BOOT=' /conf/initramfs.conf | tail -1)
8 # can be superseded by command line (used by Debian-Live's netboot for example)
9 for ARGUMENT in ${LIVE_BOOT_CMDLINE}
13 NETBOOT="${ARGUMENT#netboot=}"
18 if [ "$bootconf" != "BOOT=nfs" ] && [ -z "$NETBOOT" ] && [ -z "$FETCH" ] && [ -z "$FTPFS" ] && [ -z "$HTTPFS" ]
20 # Not a net boot : nothing to do
24 # we want to do some basic IP
27 # Ensure all our net modules get loaded so we can actually compare MAC addresses...
31 # Available Ethernet interfaces ?
34 # See if we can derive the boot device
39 echo "Waiting for ethernet card(s) up... If this fails, maybe the ethernet card is not supported by the kernel `uname -r`?"
40 while [ -z "$l_interfaces" ]
42 l_interfaces="$(cd /sys/class/net/ && ls -d eth* 2>/dev/null)"
45 if [ $(echo $l_interfaces | wc -w) -lt 2 ]
47 # only one interface : no choice
48 echo "DEVICE=$l_interfaces" >> /conf/param.conf
52 # If user force to use specific device, write it
53 for ARGUMENT in ${LIVE_BOOT_CMDLINE}
57 NETDEV="${ARGUMENT#live-netdev=}"
58 echo "DEVICE=$NETDEV" >> /conf/param.conf
59 echo "Found live-netdev parameter, forcing to to use network device $NETDEV."
65 l_interfaces="$DEVICE"
71 echo -n "Looking for a connected Ethernet interface ..."
73 for interface in $l_interfaces
75 # ATTR{carrier} is not set if this is not done
76 echo -n " $interface ?"
77 ipconfig -c none -d $interface -t 1 >/dev/null 2>&1
84 for interface in $l_interfaces
86 carrier=$(cat /sys/class/net/$interface/carrier \
92 echo "Connected $interface found"
93 # inform initrd's init script :
94 found_eth_dev="$found_eth_dev $interface"
98 if [ -n "$found_eth_dev" ]
100 echo "DEVICE='$found_eth_dev'" >> /conf/param.conf