Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 May 2012 21:21:45 +0000 (UTC)
From:      Josh Paetzel <jpaetzel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r234987 - head/usr.sbin/pc-sysinstall/backend
Message-ID:  <201205032121.q43LLj9C063807@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jpaetzel
Date: Thu May  3 21:21:45 2012
New Revision: 234987
URL: http://svn.freebsd.org/changeset/base/234987

Log:
  Add the ability to configure multiple interfaces.
  
  Submitted by:	glarkin
  Obtained from:	PC-BSD
  MFC after:	3 days

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-networking.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-networking.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend/functions-networking.sh	Thu May  3 21:16:53 2012	(r234986)
+++ head/usr.sbin/pc-sysinstall/backend/functions-networking.sh	Thu May  3 21:21:45 2012	(r234987)
@@ -192,7 +192,7 @@ save_manual_nic()
   # Get the target nic
   NIC="$1"
 
-  get_value_from_cfg netSaveIP
+  get_value_from_cfg netSaveIP_${NIC}
   NETIP="${VAL}"
  
   if [ "$NETIP" = "DHCP" ]
@@ -212,7 +212,7 @@ save_manual_nic()
     IFARGS="inet ${NETIP}"
 
     # Check if we have a netmask to set
-    get_value_from_cfg netSaveMask
+    get_value_from_cfg netSaveMask_${NIC}
     NETMASK="${VAL}"
     if [ -n "${NETMASK}" ]
     then
@@ -220,7 +220,7 @@ save_manual_nic()
     fi
   fi
 
-  get_value_from_cfg netSaveIPv6
+  get_value_from_cfg netSaveIPv6_${NIC}
   NETIP6="${VAL}"
   if [ -n "${NETIP6}" ]
   then
@@ -239,6 +239,12 @@ save_manual_nic()
     echo "ifconfig_${NIC}_ipv6=\"${IF6ARGS}\"" >>${FSMNT}/etc/rc.conf
   fi
 
+};
+
+# Function which saves a manual gateway router setup to the installed system
+save_manual_router()
+{
+
   # Check if we have a default router to set
   get_value_from_cfg netSaveDefaultRouter
   NETROUTE="${VAL}"
@@ -253,19 +259,30 @@ save_manual_nic()
     echo "ipv6_defaultrouter=\"${NETROUTE}\"" >>${FSMNT}/etc/rc.conf
   fi
 
+};
+
+save_manual_nameserver()
+{
   # Check if we have a nameserver to enable
   : > ${FSMNT}/etc/resolv.conf
-  get_value_from_cfg netSaveNameServer
-  NAMESERVER="${VAL}"
-  if [ -n "${NAMESERVER}" ]
-  then
-    echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf
-  fi
-  get_value_from_cfg netSaveIPv6NameServer
-  NAMESERVER="${VAL}"
-  if [ -n "${NAMESERVER}" ]
-  then
-    echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf
+  get_value_from_cfg_with_spaces netSaveNameServer
+  NAMESERVERLIST="${VAL}"
+  if [ ! -z "${NAMESERVERLIST}" ]
+  then
+    for NAMESERVER in ${NAMESERVERLIST}
+    do
+      echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf
+    done
+  fi
+
+  get_value_from_cfg_with_spaces netSaveIPv6NameServer
+  NAMESERVERLIST="${VAL}"
+  if [ ! -z "${NAMESERVERLIST}" ]
+  then
+    for NAMESERVER in ${NAMESERVERLIST}
+    do
+      echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf
+    done
   fi
 
 };
@@ -454,25 +471,30 @@ save_networking_install()
 {
 
   # Check if we have any networking requested to save
-  get_value_from_cfg netSaveDev
+  get_value_from_cfg_with_spaces netSaveDev
   if [ -z "${VAL}" ]
   then
     return 0
   fi
 
-  NETDEV="${VAL}"
-  if [ "$NETDEV" = "AUTO-DHCP" ]
+  NETDEVLIST="${VAL}"
+  if [ "$NETDEVLIST" = "AUTO-DHCP" ]
   then
     save_auto_dhcp
-  elif [ "$NETDEV" = "IPv6-SLAAC" ]
+  elif [ "$NETDEVLIST" = "IPv6-SLAAC" ]
   then
     save_auto_slaac
-  elif [ "$NETDEV" = "AUTO-DHCP-SLAAC" ]
+  elif [ "$NETDEVLIST" = "AUTO-DHCP-SLAAC" ]
   then
     save_auto_dhcp
     save_auto_slaac
   else
-    save_manual_nic ${NETDEV}
+    for NETDEV in ${NETDEVLIST}
+    do
+      save_manual_nic ${NETDEV}
+    done
+    save_manual_router
+    save_manual_nameserver
   fi
 
 };



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205032121.q43LLj9C063807>