X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Fboot%2F9990-select-eth-device.sh;h=7d1aa163282e002b68ebb7b9956a3b34fce2e3ec;hb=f788126730ccd13eeef5a7a97796e001cfc6bb50;hp=ed1da6fcae439b4c18eca688eda656419fd63e90;hpb=2e70d7be610c9e45787c37352d36241de3c155d7;p=live-boot-grml.git diff --git a/scripts/boot/9990-select-eth-device.sh b/scripts/boot/9990-select-eth-device.sh index ed1da6f..7d1aa16 100755 --- a/scripts/boot/9990-select-eth-device.sh +++ b/scripts/boot/9990-select-eth-device.sh @@ -6,7 +6,7 @@ Select_eth_device () bootconf=$(egrep '^BOOT=' /conf/initramfs.conf | tail -1) # can be superseded by command line (used by Debian-Live's netboot for example) - for ARGUMENT in $(cat /proc/cmdline) + for ARGUMENT in ${LIVE_BOOT_CMDLINE} do case "${ARGUMENT}" in netboot=*) @@ -26,31 +26,40 @@ Select_eth_device () # Available Ethernet interfaces ? l_interfaces="" - echo "Waiting for ethernet card(s) up... If this fails, maybe the ethernet card is not supported by the kernel `uname -r`?" - while [ -z "$l_interfaces" ] - do - l_interfaces="$(cd /sys/class/net/ && ls -d eth* 2>/dev/null)" - done - if [ $(echo $l_interfaces | wc -w) -lt 2 ] + # See if we can derive the boot device + Device_from_bootif + + if [ -z "$DEVICE" ] then - # only one interface : no choice - echo "DEVICE=$l_interfaces" >> /conf/param.conf - return - fi + echo "Waiting for ethernet card(s) up... If this fails, maybe the ethernet card is not supported by the kernel `uname -r`?" + while [ -z "$l_interfaces" ] + do + l_interfaces="$(cd /sys/class/net/ && ls -d eth* 2>/dev/null)" + done - # If user force to use specific device, write it - for ARGUMENT in $(cat /proc/cmdline) - do - case "${ARGUMENT}" in - live-netdev=*) + if [ $(echo $l_interfaces | wc -w) -lt 2 ] + then + # only one interface : no choice + echo "DEVICE=$l_interfaces" >> /conf/param.conf + return + fi + + # If user force to use specific device, write it + for ARGUMENT in ${LIVE_BOOT_CMDLINE} + do + case "${ARGUMENT}" in + live-netdev=*) NETDEV="${ARGUMENT#live-netdev=}" echo "DEVICE=$NETDEV" >> /conf/param.conf - echo "Found live-netdev parameter in /proc/cmdline. Force to use network device $NETDEV." + echo "Found live-netdev parameter, forcing to to use network device $NETDEV." return ;; - esac - done + esac + done + else + l_interfaces="$DEVICE" + fi found_eth_dev="" while true