Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jun 2011 14:25:27 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222619 - head/usr.sbin/bsdinstall/scripts
Message-ID:  <201106021425.p52EPRYZ021511@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Thu Jun  2 14:25:27 2011
New Revision: 222619
URL: http://svn.freebsd.org/changeset/base/222619

Log:
  Write the multi step netconfig to a temporary file and only move that
  to the final name if netconfig was completely finished.  This fixes
  reentrance problems even better than r222611.
  
  Suggested by:	nwhitehorn
  Reviewed by:	nwhitehorn
  Sponsored by:	The FreeBSD Foundation
  Sponsored by:	iXsystems

Modified:
  head/usr.sbin/bsdinstall/scripts/netconfig
  head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
  head/usr.sbin/bsdinstall/scripts/netconfig_ipv6

Modified: head/usr.sbin/bsdinstall/scripts/netconfig
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/netconfig	Thu Jun  2 14:23:36 2011	(r222618)
+++ head/usr.sbin/bsdinstall/scripts/netconfig	Thu Jun  2 14:25:27 2011	(r222619)
@@ -54,14 +54,14 @@ INTERFACE=`echo $DIALOG_TAGS | xargs dia
 if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi
 exec 3>&-
 
-: > $BSDINSTALL_TMPETC/rc.conf.net
+: > $BSDINSTALL_TMPETC/._rc.conf.net
 
 # Do a dirty check to see if this a wireless interface -- there should be a
 # better way
 IFCONFIG_PREFIX=""
 if ifconfig $INTERFACE | grep -q 'media: IEEE 802.11 Wireless'; then
 	NEXT_WLAN_IFACE=wlan0	# XXX
-	echo wlans_$INTERFACE=\"$NEXT_WLAN_IFACE\" >> $BSDINSTALL_TMPETC/rc.conf.net
+	echo wlans_$INTERFACE=\"$NEXT_WLAN_IFACE\" >> $BSDINSTALL_TMPETC/._rc.conf.net
 	IFCONFIG_PREFIX="WPA "
 	if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
 		ifconfig $NEXT_WLAN_IFACE create wlandev $INTERFACE
@@ -95,7 +95,7 @@ fi
 # In case wlanconfig left an option and we do not support IPv4 we need to write
 # it out on its own.  We cannot write it out with IPv6 as that suffix.
 if [ ${IPV4_AVAIL} -eq 0 -a -n ${IFCONFIG_PREFIX} ]; then
-	echo ifconfig_${INTERFACE}=\"${IFCONFIG_PREFIX}\" >> $BSDINSTALL_TMPETC/rc.conf.net
+	echo ifconfig_${INTERFACE}=\"${IFCONFIG_PREFIX}\" >> $BSDINSTALL_TMPETC/._rc.conf.net
 fi
 if [ ${IPV6_AVAIL} -eq 1 ]; then
 	dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
@@ -192,3 +192,4 @@ BEGIN {
 	printf "nameserver %s\n", $1;
 }' > ${BSDINSTALL_TMPETC}/resolv.conf
 
+mv $BSDINSTALL_TMPETC/._rc.conf.net $BSDINSTALL_TMPETC/rc.conf.net

Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4	Thu Jun  2 14:23:36 2011	(r222618)
+++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4	Thu Jun  2 14:25:27 2011	(r222619)
@@ -44,7 +44,7 @@ esac
 
 dialog --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=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/rc.conf.net
+	echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net
 
 	if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
 		dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0
@@ -74,10 +74,10 @@ echo $INTERFACE $IF_CONFIG | 
     awk -v prefix="$IFCONFIG_PREFIX" '{
 	printf("ifconfig_%s=\"%s inet %s netmask %s\"\n", $1, prefix, $2, $3);
 	printf("defaultrouter=\"%s\"\n", $4);
-    }' >> $BSDINSTALL_TMPETC/rc.conf.net
+    }' >> $BSDINSTALL_TMPETC/._rc.conf.net
 
 if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
-	. $BSDINSTALL_TMPETC/rc.conf.net
+	. $BSDINSTALL_TMPETC/._rc.conf.net
 	ifconfig $INTERFACE inet `eval echo \\\$ifconfig_$INTERFACE`
 	route delete -inet default
 	route add -inet default $defaultrouter

Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/netconfig_ipv6	Thu Jun  2 14:23:36 2011	(r222618)
+++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6	Thu Jun  2 14:25:27 2011	(r222619)
@@ -69,7 +69,7 @@ while : ; do
 				continue
 			fi
 		fi
-		echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/rc.conf.net
+		echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/._rc.conf.net
 		exit 0
 	else
 		break
@@ -138,10 +138,10 @@ BEGIN {
 		sub("$", "/64", $1);
 	}
 	printf("ifconfig_%s_ipv6=\"inet6 %s\"\n", iface, $1);
-}' >> $BSDINSTALL_TMPETC/rc.conf.net
+}' >> $BSDINSTALL_TMPETC/._rc.conf.net
 
 if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
-	. $BSDINSTALL_TMPETC/rc.conf.net
+	. $BSDINSTALL_TMPETC/._rc.conf.net
 	ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6`
 	route delete default
 	route add default ${ipv6_defaultrouter}



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