6 echo -n "Waiting for link to come up on $1... "
8 for step in $(seq 1 15)
10 carrier=$(cat /sys/class/net/$1/carrier \
14 echo -e "\nLink is up"
24 echo -e "\nError - carrier not detected on $1."
30 # Boot type in initramfs's config
31 bootconf=$(egrep '^BOOT=' /conf/initramfs.conf | tail -1)
33 # can be superseded by command line (used by Debian-Live's netboot for example)
34 for ARGUMENT in ${LIVE_BOOT_CMDLINE}
38 NETBOOT="${ARGUMENT#netboot=}"
43 if [ "$bootconf" != "BOOT=nfs" ] && [ -z "$NETBOOT" ] && [ -z "$FETCH" ] && [ -z "$FTPFS" ] && [ -z "$HTTPFS" ]
45 # Not a net boot : nothing to do
49 # we want to do some basic IP
52 # Ensure all our net modules get loaded so we can actually compare MAC addresses...
56 # Available Ethernet interfaces ?
59 # See if we can derive the boot device
64 echo "Waiting for ethernet card(s) up... If this fails, maybe the ethernet card is not supported by the kernel `uname -r`?"
65 while [ -z "$l_interfaces" ]
67 l_interfaces="$(cd /sys/class/net/ && ls -d * 2>/dev/null | grep -v "lo")"
70 if [ $(echo $l_interfaces | wc -w) -lt 2 ]
72 # only one interface : no choice
73 echo "DEVICE=$l_interfaces" >> /conf/param.conf
74 Wait_for_carrier $l_interfaces
78 # If user force to use specific device, write it
79 for ARGUMENT in ${LIVE_BOOT_CMDLINE}
83 NETDEV="${ARGUMENT#live-netdev=}"
84 echo "DEVICE=$NETDEV" >> /conf/param.conf
85 echo "Found live-netdev parameter, forcing to to use network device $NETDEV."
86 Wait_for_carrier $NETDEV
92 l_interfaces="$DEVICE"
98 echo -n "Looking for a connected Ethernet interface ..."
100 for interface in $l_interfaces
102 # ATTR{carrier} is not set if this is not done
103 echo -n " $interface ?"
104 ipconfig -c none -d $interface -t 1 >/dev/null 2>&1
110 for step in 1 2 3 4 5
112 for interface in $l_interfaces
114 ip link set $interface up
115 carrier=$(cat /sys/class/net/$interface/carrier \
121 echo "Connected $interface found"
122 # inform initrd's init script :
123 found_eth_dev="$found_eth_dev $interface"
124 found_eth_dev="$(echo $found_eth_dev | sed -e "s/^[[:space:]]*//g")"
128 if [ -n "$found_eth_dev" ]
130 echo "DEVICE='$found_eth_dev'" >> /conf/param.conf