svn commit: r235444 - stable/9/usr.sbin/pc-sysinstall/backend

Josh Paetzel jpaetzel at FreeBSD.org
Mon May 14 15:08:46 UTC 2012


Author: jpaetzel
Date: Mon May 14 15:08:45 2012
New Revision: 235444
URL: http://svn.freebsd.org/changeset/base/235444

Log:
  MFC 234987:
  
  Add the ability to configure multiple interfaces
  
  Submitted by:	glarkin
  Obtained from:	PC-BSD

Modified:
  stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh
Directory Properties:
  stable/9/usr.sbin/pc-sysinstall/   (props changed)

Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh
==============================================================================
--- stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh	Mon May 14 15:06:04 2012	(r235443)
+++ stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh	Mon May 14 15:08:45 2012	(r235444)
@@ -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
 
 };


More information about the svn-src-stable-9 mailing list