diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-04-23 22:55:47 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-04-23 23:25:50 +0000 |
commit | 1b6c4f13413ba11d1710b55fe2a352122c825bdd (patch) | |
tree | 4639bc0cea7bc2892a9b7b13ef23cfee721b9799 | |
parent | 4789984c67aeab3935d59bcb0cace15ac7f88a37 (diff) | |
download | live-1b6c4f13413ba11d1710b55fe2a352122c825bdd.tar.gz |
Use 30 sec timeout, but only if if is up2013-04-23/netinst
-rwxr-xr-x | net-physical | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/net-physical b/net-physical index ecac45f..6b5ac20 100755 --- a/net-physical +++ b/net-physical @@ -1,16 +1,25 @@ #!/bin/sh -links=`dladm show-phys -o link 2>/dev/null| grep -v LINK` +links=`dladm show-phys -p -o link` for link in $links; do - if ipadm "create-if" $link 2>/dev/null; then # create-if is in quotes because ViM goes crazy + if ipadm "create-if" $link; then # create-if is in quotes because ViM goes crazy + timeout=30 + state=`dladm show-phys -p -o state $link` + if [ "$state" != up ]; then + # http://slackware.com/~alien/rc_scripts/rc.inet1 + timeout=7 + fi echo "Trying DHCP for $link ... " >/dev/msglog - if ipadm create-addr -T dhcp -w 7 $link/dhcp 2>/dev/null; then - echo "Configured $link via DHCP" >/dev/msglog - exit 0 - else - echo "DHCP for $link FAILED " >/dev/msglog + if ipadm create-addr -T dhcp -w $timeout $link/dhcp; then + addrstate=`ipadm show-addr -p -o state $link/dhcp` + if [ "$addrstate" = ok ]; then + echo "Configured $link via DHCP" >/dev/msglog + exit 0 + else + ipadm delete-addr $link/dhcp + fi fi fi done |