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" ] && [ "$NETBOOT" = "" ]; then
34 # Not a net boot : nothing to do
38 # be sure this has been run (*should* be done by scripts/init-premount/udev)
42 # we want to do some basic IP
45 # Available Ethernet interfaces ?
46 l_interfaces=$(cd /sys/class/net/ && ls -d eth* 2>/dev/null)
48 if [ $(echo $l_interfaces | wc -w) -lt 2 ]; then
49 # only one interface : no choice
50 echo "DEVICE=$l_interfaces" >> /conf/param.conf
55 echo -n "Looking for a connected Ethernet interface ..."
57 for interface in $l_interfaces; do
58 # ATTR{carrier} is not set if this is not done
59 echo -n " $interface ?"
60 ipconfig -c none -d $interface -t 1 >/dev/null 2>&1
65 for step in 1 2 3 4 5; do
66 for interface in $l_interfaces; do
67 carrier=$(cat /sys/class/net/$interface/carrier \
70 if [ "$carrier" = 1 ]; then
71 echo " found $interface."
72 # inform initrd's init script :
73 echo "DEVICE=$interface" >> /conf/param.conf