Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2011 01:07:32 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r216985 - user/nwhitehorn/bsdinstall/scripts
Message-ID:  <201101050107.p0517WPf060652@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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