Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2023 16:48:59 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 60b37735f305 - main - bsdinstall netconfig: avoid duplicate entries in rc.conf
Message-ID:  <202310131648.39DGmxSS014795@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=60b37735f305e72e67695ead029e59ea29b2bc29

commit 60b37735f305e72e67695ead029e59ea29b2bc29
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2023-10-13 15:45:19 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-13 16:45:54 +0000

    bsdinstall netconfig: avoid duplicate entries in rc.conf
    
    This uses sysrc to write and update configuration variables in the
    temporary configuration file for network access, ._rc.conf.net. This
    replaces the previous mechanism, which was simply appending new values
    as they were updated.
    
    PR:             212396
    Reviewed by:    emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D42194
---
 usr.sbin/bsdinstall/scripts/netconfig      | 4 ++--
 usr.sbin/bsdinstall/scripts/netconfig_ipv4 | 2 +-
 usr.sbin/bsdinstall/scripts/netconfig_ipv6 | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/netconfig b/usr.sbin/bsdinstall/scripts/netconfig
index 99c129ab61f5..addf5cb527d6 100755
--- a/usr.sbin/bsdinstall/scripts/netconfig
+++ b/usr.sbin/bsdinstall/scripts/netconfig
@@ -81,7 +81,7 @@ exec 5>&-
 IFCONFIG_PREFIX=""
 if is_wireless_if $INTERFACE; then
 	NEXT_WLAN_IFACE=wlan0	# XXX
-	echo wlans_$INTERFACE=\"$NEXT_WLAN_IFACE\" >> $BSDINSTALL_TMPETC/._rc.conf.net
+	sysrc -f $BSDINSTALL_TMPETC/._rc.conf.net wlans_$INTERFACE "$NEXT_WLAN_IFACE"
 	IFCONFIG_PREFIX="WPA "
 	if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
 		ifconfig $NEXT_WLAN_IFACE create wlandev $INTERFACE
@@ -115,7 +115,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
+	sysrc -f $BSDINSTALL_TMPETC/._rc.conf.net ifconfig_$INTERFACE "${IFCONFIG_PREFIX}"
 fi
 if [ ${IPV6_AVAIL} -eq 1 ]; then
 	bsddialog --backtitle "$OSNAME Installer" --title 'Network Configuration' \
diff --git a/usr.sbin/bsdinstall/scripts/netconfig_ipv4 b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
index 3da1803cd0d1..9097a1f9617c 100755
--- a/usr.sbin/bsdinstall/scripts/netconfig_ipv4
+++ b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
@@ -63,7 +63,7 @@ if [ $? -eq $BSDDIALOG_OK ]; then
 			exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}"
 		fi
 	fi
-	echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net
+	sysrc -f $BSDINSTALL_TMPETC/._rc.conf.net ifconfig_$INTERFACE "${IFCONFIG_PREFIX}DHCP"
 	exit 0
 fi
 
diff --git a/usr.sbin/bsdinstall/scripts/netconfig_ipv6 b/usr.sbin/bsdinstall/scripts/netconfig_ipv6
index 00ef8791de4b..99ec379197fb 100755
--- a/usr.sbin/bsdinstall/scripts/netconfig_ipv6
+++ b/usr.sbin/bsdinstall/scripts/netconfig_ipv6
@@ -73,7 +73,7 @@ while : ; do
 				continue
 			fi
 		fi
-		echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/._rc.conf.net
+		sysrc -f $BSDINSTALL_TMPETC/._rc.conf.net ifconfig_${INTERFACE}_ipv6 "inet6 accept_rtadv"
 		exit 0
 	else
 		break



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