diff --git a/etc/net/scripts/create-eth b/etc/net/scripts/create-eth index 4554c0e..6fdfa2c 100755 --- a/etc/net/scripts/create-eth +++ b/etc/net/scripts/create-eth @@ -8,6 +8,24 @@ if [ -n "$MODULE" ]; then for oneword in $MODULE; do $MODPROBE $oneword done -else +fi + +if $IP li sh dev $NAME 2>/dev/null; then + # iface $NAME at least exists $IP link set dev $NAME down + exit 0 fi + +# nope, try to guess from iftab +if profiled_filename IFTAB_FILE "$IFTAB"; then + while read junk junk junk junk from junk to; do + if [ "$NAME" = "${to%.*}" ]; then + # iface will be renamed to $NAME later + $IP link set dev $from down + exit 0 + fi + done <<< "$($IFRENAME -c "$IFTAB_FILE" -D 2>&1)" +fi + +# still nothing, bail out +exit 1