[PC-BSD Commits] r6405 - pcbsd/trunk/pc-sysinstall/backend
svn at pcbsd.org
svn at pcbsd.org
Sat Mar 13 14:41:10 PST 2010
Author: kris
Date: 2010-03-13 14:41:10 -0800 (Sat, 13 Mar 2010)
New Revision: 6405
Modified:
pcbsd/trunk/pc-sysinstall/backend/functions-networking.sh
Log:
Speed up by only trying dhcp on nics which are active
Modified: pcbsd/trunk/pc-sysinstall/backend/functions-networking.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-networking.sh 2010-03-13 10:04:01 UTC (rev 6404)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-networking.sh 2010-03-13 22:41:10 UTC (rev 6405)
@@ -190,7 +190,18 @@
};
+# Function which determines if a nic is active / up
+is_nic_active()
+{
+ ifconfig ${1} | grep "status: active" >/dev/null 2>/dev/null
+ if [ "$?" = "0" ] ; then
+ return 0
+ else
+ return 1
+ fi
+};
+
# Function which detects available nics, and runs DHCP on them until
# a success is found
enable_auto_dhcp()
@@ -201,12 +212,15 @@
do
NIC="`echo $line | cut -d ':' -f 1`"
DESC="`echo $line | cut -d ':' -f 2`"
- echo_log "Trying DHCP on $NIC $DESC"
- dhclient ${NIC} >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Got a valid DHCP IP, we can return now
- return 0
+
+ is_nic_active "${NIC}"
+ if [ "$?" = "0" ] ; then
+ echo_log "Trying DHCP on $NIC $DESC"
+ dhclient ${NIC} >/dev/null 2>/dev/null
+ if [ "$?" = "0" ] ; then
+ # Got a valid DHCP IP, we can return now
+ return 0
+ fi
fi
done < ${TMPDIR}/.niclist
More information about the Commits
mailing list