[PC-BSD Commits] r5995 - pcbsd/trunk/pc-sysinstall/backend
svn at pcbsd.org
svn at pcbsd.org
Wed Jan 13 11:38:29 PST 2010
Author: kris
Date: 2010-01-13 11:38:29 -0800 (Wed, 13 Jan 2010)
New Revision: 5995
Modified:
pcbsd/trunk/pc-sysinstall/backend/functions-networking.sh
Log:
Added support to pc-sysinstall to create a fancy lagg0 interface when using auto-dhcp, and we find
a wifi device, otherwise stick with plain ole' dhcp setup
Modified: pcbsd/trunk/pc-sysinstall/backend/functions-networking.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-networking.sh 2010-01-13 19:04:51 UTC (rev 5994)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-networking.sh 2010-01-13 19:38:29 UTC (rev 5995)
@@ -28,12 +28,34 @@
fi
};
-# Function which detects available nics, and runs sets them to DHCP on the
-# system
-save_auto_dhcp()
+# Function to get the first available wired nic, used for lagg0 setup
+get_first_wired_nic()
{
rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null
+ # start by getting a list of nics on this system
+ ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
+ if [ -e "${TMPDIR}/.niclist" ]
+ then
+ while read line
+ do
+ NIC="`echo $line | cut -d ':' -f 1`"
+ check_is_wifi ${NIC}
+ if [ "$?" != "0" ]
+ then
+ VAL="${NIC}" ; export VAL
+ return
+ fi
+ done < ${TMPDIR}/.niclist
+ fi
+ VAL="" ; export VAL
+ return
+};
+
+# Function which simply enables plain dhcp on all detected nics, not fancy lagg interface
+enable_plain_dhcp_all()
+{
+ rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null
# start by getting a list of nics on this system
${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
if [ -e "${TMPDIR}/.niclist" ]
@@ -59,16 +81,57 @@
CNIC="${NIC}"
fi
-
- # If we are installing PC-BSD, lets create .desktop links
- if [ "$INSTALLTYPE" = "PCBSD" ]
+ done < ${TMPDIR}/.niclist
+ fi
+};
+
+# Function which enables fancy lagg dhcp on specified wifi
+enable_lagg_dhcp()
+{
+ WIFINIC="$1"
+ get_first_wired_nic;
+ WIRENIC=$VAL
+ LAGGPORT="laggport ${WIFINIC}"
+
+ echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf
+ if [ ! -z "$WIRENIC" ]
+ then
+ echo "ifconfig_${WIRENIC}=\"up\"" >> ${FSMNT}/etc/rc.conf
+ echo "ifconfig_${WIFINIC}=\"\`ifconfig ${WIRENIC} ether\`\"" >> ${FSMNT}/etc/rc.conf
+ echo "ifconfig_${WIFINIC}=\"ether \${ifconfig_${WIFINIC}##*ether }\"" >> ${FSMNT}/etc/rc.conf
+ LAGGPORT="laggport ${WIRENIC} ${LAGGPORT}"
+ fi
+
+ echo "wlans_${WIFINIC}=\"wlan0\"" >> ${FSMNT}/etc/rc.conf
+ echo "cloned_interfaces=\"lagg0\"" >> ${FSMNT}/etc/rc.conf
+ echo "ifconfig_lagg0=\"laggproto failover ${LAGGPORT} DHCP\"" >> ${FSMNT}/etc/rc.conf
+
+};
+
+# Function which detects available nics, and runs them to DHCP on the
+save_auto_dhcp()
+{
+ rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null
+ # start by getting a list of nics on this system
+ ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
+ if [ -e "${TMPDIR}/.niclist" ]
+ then
+ while read line
+ do
+ check_is_wifi ${NIC}
+ if [ "$?" = "0" ]
then
- ceate_desktop_nettray "${CNIC}"
+ # We have a wifi device, lets do fancy lagg interface
+ enable_lagg_dhcp "${NIC}"
+ return
fi
-
+
done < ${TMPDIR}/.niclist
fi
+ # Got here, looks like no wifi, so lets simply enable plain-ole-dhcp
+ enable_plain_dhcp_all
+
};
More information about the Commits
mailing list