[Midnightbsd-cvs] src [11311] U trunk/usr.sbin/bsdinstall/scripts: update netconfig

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Jul 4 10:11:35 EDT 2018


Revision: 11311
          http://svnweb.midnightbsd.org/src/?rev=11311
Author:   laffer1
Date:     2018-07-04 10:11:34 -0400 (Wed, 04 Jul 2018)
Log Message:
-----------
update netconfig

Modified Paths:
--------------
    trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv4
    trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv6

Property Changed:
----------------
    trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv4
    trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv6

Modified: trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv4
===================================================================
--- trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv4	2018-07-04 14:10:02 UTC (rev 11310)
+++ trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv4	2018-07-04 14:11:34 UTC (rev 11311)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
+# Copyright (c) 2013-2015 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -24,16 +25,18 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
+# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4 323337 2017-09-09 01:23:30Z emaste $
 # $MidnightBSD$
-# $FreeBSD: src/usr.sbin/bsdinstall/scripts/netconfig_ipv4,v 1.5 2011/09/16 09:37:13 nwhitehorn Exp $
+#
+############################################################ INCLUDES
 
-: ${DIALOG_OK=0}
-: ${DIALOG_CANCEL=1}
-: ${DIALOG_HELP=2}
-: ${DIALOG_EXTRA=3}
-: ${DIALOG_ITEM_HELP=4}
-: ${DIALOG_ESC=255}
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+f_dprintf "%s: loading includes..." "$0"
+f_include $BSDCFG_SHARE/dialog.subr
 
+############################################################ MAIN
+
 INTERFACE=$1
 IFCONFIG_PREFIX="$2"
 test -z "$IFCONFIG_PREFIX" || IFCONFIG_PREFIX="$2 "
@@ -46,16 +49,16 @@
 
 dialog --backtitle 'MidnightBSD 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
-
 	if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
 		dialog --backtitle 'MidnightBSD Installer' --infobox "Acquiring DHCP lease..." 0 0
-		dhclient $INTERFACE 2>> $BSDINSTALL_LOG
+		err=$( dhclient $INTERFACE 2>&1 )
 		if [ $? -ne 0 ]; then
+			f_dprintf "%s" "$err"
 			dialog --backtitle 'MidnightBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0
 			exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}"
 		fi
 	fi
+	echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net
 	exit 0
 fi
 
@@ -74,16 +77,23 @@
 
 echo $INTERFACE $IF_CONFIG | 
     awk -v prefix="$IFCONFIG_PREFIX" '{
-	printf("ifconfig_%s=\"%s inet %s netmask %s\"\n", $1, prefix, $2, $3);
+	printf("ifconfig_%s=\"%s\inet %s netmask %s\"\n", $1, prefix, $2, $3);
 	printf("defaultrouter=\"%s\"\n", $4);
     }' >> $BSDINSTALL_TMPETC/._rc.conf.net
+retval=$?
 
-if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
+if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
 	. $BSDINSTALL_TMPETC/._rc.conf.net
 	ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE`
-	if [ -n "${defaultrouter}" ]; then
+	if [ "$defaultrouter" ]; then
 		route delete -inet default
 		route add -inet default $defaultrouter
+		retval=$?
 	fi
 fi
 
+exit $retval
+
+################################################################################
+# END
+################################################################################


Property changes on: trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv4
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv6
===================================================================
--- trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv6	2018-07-04 14:10:02 UTC (rev 11310)
+++ trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv6	2018-07-04 14:11:34 UTC (rev 11311)
@@ -1,8 +1,8 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
-# All rights reserved.
 # Copyright (c) 2011 The FreeBSD Foundation
+# Copyright (c) 2013-2015 Devin Teske
 # All rights reserved.
 #
 # Portions of this software were developed by Bjoern Zeeb
@@ -29,21 +29,23 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
+# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv6 290290 2015-11-02 22:06:44Z dteske $
 # $MidnightBSD$
-# $FreeBSD: src/usr.sbin/bsdinstall/scripts/netconfig_ipv6,v 1.6 2011/09/07 00:45:15 bz Exp $
+#
+############################################################ INCLUDES
 
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+f_dprintf "%s: loading includes..." "$0"
+f_include $BSDCFG_SHARE/dialog.subr
+
+############################################################ MAIN
+
 #
 # TODO: 
 # - Add DHCPv6 support once MidnightBSD ships with it.
 # 
 
-: ${DIALOG_OK=0}
-: ${DIALOG_CANCEL=1}
-: ${DIALOG_HELP=2}
-: ${DIALOG_EXTRA=3}
-: ${DIALOG_ITEM_HELP=4}
-: ${DIALOG_ESC=255}
-
 INTERFACE=$1
 case "${INTERFACE}" in
 "")	dialog --backtitle 'MidnightBSD Installer' --title 'Network Configuration' \
@@ -62,8 +64,9 @@
 			dialog --backtitle 'MidnightBSD Installer' \
 			    --infobox "Sending Router Solicitation ..." 0 0
 			ifconfig ${INTERFACE} inet6 -ifdisabled accept_rtadv up
-			rtsol -F $INTERFACE 2>> $BSDINSTALL_LOG
+			err=$( rtsol -F $INTERFACE 2>&1 )
 			if [ $? -ne 0 ]; then
+				f_dprintf "%s" "$err"
 				dialog --backtitle 'MidnightBSD Installer' --msgbox "SLAAC failed." 0 0
 				AGAIN=" again"
 				continue
@@ -139,13 +142,20 @@
 	}
 	printf("ifconfig_%s_ipv6=\"inet6 %s\"\n", iface, $1);
 }' >> $BSDINSTALL_TMPETC/._rc.conf.net
+retval=$?
 
-if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
+if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
 	. $BSDINSTALL_TMPETC/._rc.conf.net
 	ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6`
-	if [ -n "${ipv6_defaultrouter}" ]; then
+	if [ "$ipv6_defaultrouter" ]; then
 		route delete -inet6 default
 		route add -inet6 default ${ipv6_defaultrouter}
+		retval=$?
 	fi
 fi
 
+exit $retval
+
+################################################################################
+# END
+################################################################################


Property changes on: trunk/usr.sbin/bsdinstall/scripts/netconfig_ipv6
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list