3 # Original script by Andreas Teuchert <ant+dl@hsg-kl.de>
4 # Modified by Frédéric Boiteux <fboiteux@calistel.com>
6 PREREQ
="blacklist udev"
21 # Boot type in initramfs's config
22 bootconf
=$
(egrep '^BOOT=' /conf
/initramfs.conf |
tail -1)
24 # can be superseded by command line (used by Debian-Live's netboot for example)
25 for ARGUMENT
in $
(cat /proc
/cmdline
); do
28 NETBOOT
="${ARGUMENT#netboot=}"
33 if [ "$bootconf" != "BOOT=nfs" ] &&
34 [ "$NETBOOT" = "" ] &&
39 # Not a net boot : nothing to do
43 # we want to do some basic IP
46 # Available Ethernet interfaces ?
48 echo "Waiting for ethernet card(s) up... If this fails, maybe the ethernet card is not supported by the kernel `uname -r`?"
49 while [ -z "$l_interfaces" ]; do
50 l_interfaces
="$(cd /sys/class/net/ && ls -d eth* 2>/dev/null)"
53 if [ $
(echo $l_interfaces |
wc -w) -lt 2 ]; then
54 # only one interface : no choice
55 echo "DEVICE=$l_interfaces" >> /conf
/param.conf
59 # If user force to use specific device, write it
60 for ARGUMENT
in $
(cat /proc
/cmdline
); do
63 NETDEV
="${ARGUMENT#live-netdev=}"
64 echo "DEVICE=$NETDEV" >> /conf
/param.conf
65 echo "Found live-netdev parameter in /proc/cmdline. Force to use network device $NETDEV."
73 echo -n "Looking for a connected Ethernet interface ..."
75 for interface
in $l_interfaces; do
76 # ATTR{carrier} is not set if this is not done
77 echo -n " $interface ?"
78 ipconfig
-c none
-d $interface -t 1 >/dev
/null
2>&1
83 for step
in 1 2 3 4 5; do
84 for interface
in $l_interfaces; do
85 carrier
=$
(cat /sys
/class
/net
/$interface/carrier \
88 if [ "$carrier" = 1 ]; then
89 echo "Connected $interface found"
90 # inform initrd's init script :
91 found_eth_dev
="$found_eth_dev $interface"
94 if [ -n "$found_eth_dev" ]; then
95 echo "DEVICE='$found_eth_dev'" >> /conf
/param.conf