svn commit: r216985 - user/nwhitehorn/bsdinstall/scripts

Nathan Whitehorn nwhitehorn at FreeBSD.org
Wed Jan 5 01:07:32 UTC 2011


Author: nwhitehorn
Date: Wed Jan  5 01:07:32 2011
New Revision: 216985
URL: http://svn.freebsd.org/changeset/base/216985

Log:
  Add a new variable (BSDINSTALL_CONFIGCURRENT), which, if set, will cause
  the installer to configure the current system in addition to the new one.
  This is for use by the network configuration script, which now does the
  appropriate thing in this case.

Modified:
  user/nwhitehorn/bsdinstall/scripts/netconfig

Modified: user/nwhitehorn/bsdinstall/scripts/netconfig
==============================================================================
--- user/nwhitehorn/bsdinstall/scripts/netconfig	Wed Jan  5 00:19:40 2011	(r216984)
+++ user/nwhitehorn/bsdinstall/scripts/netconfig	Wed Jan  5 01:07:32 2011	(r216985)
@@ -26,6 +26,15 @@ exec 3>&-
 cdialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0
 if [ $? -eq $DIALOG_OK ]; then
 	echo ifconfig_$INTERFACE=\"DHCP\" >> /tmp/rc.conf
+
+	if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
+		cdialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0
+		dhclient $INTERFACE 2>> $BSDINSTALL_LOG
+		if [ $? -ne 0 ]; then
+			cdialog --backtitle 'FreeBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0
+			exec $0
+		fi
+	fi
 	exit 0
 fi
 
@@ -51,6 +60,14 @@ echo $INTERFACE $IF_CONFIG | 
 	printf("defaultrouter=\"%s\"\n", $4);
     }' >> /tmp/rc.conf
 
+if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
+	. /tmp/rc.conf
+	ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE`
+	route delete default
+	route add default $defaultrouter
+fi
+
+
 echo $IF_CONFIG | 
     awk '{
 	if ($4 != "")
@@ -59,3 +76,6 @@ echo $IF_CONFIG | 
 		printf("search %s\n", $5);
     }' > /tmp/resolv.conf
 
+if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
+	cp /tmp/resolv.conf /etc/resolv.conf
+fi


More information about the svn-src-user mailing list