Subject: install.sub:configure_ifs() broken in 1.4.
To: None <tech-install@netbsd.org>
From: matthew green <mrg@eterna.com.au>
List: tech-install
Date: 06/27/1999 05:25:56
hi folks.


in tracking down problems with the sparc install floppy i found that
changes to ifconfig(8) output in relation to 'media' completely broke
ifmedia handling in the miniroot/install.sub:configure_ifs() function.

here's my proposed patch.  it also allows saying `none' for `media'
and `link' options, which lets you set nothing even if something is
suggested by the program.


comments on this ASAP are requested as this really is necessary for
1.4.1!!


Index: miniroot/install.sub
===================================================================
RCS file: /cvsroot/basesrc/distrib/miniroot/install.sub,v
retrieving revision 1.25.2.2
diff -p -c -r1.25.2.2 install.sub
*** install.sub	1999/06/18 16:19:10	1.25.2.2
--- install.sub	1999/06/26 19:20:11
*************** configure_ifs() {
*** 374,379 ****
--- 374,380 ----
  	local _interface_mediumtype
  	local _interface_supported_media
  	local _m
+ 	local _t
  
  	_interface_name=$1
  	_up=DOWN
*************** configure_ifs() {
*** 382,402 ****
  	fi
  
  	_interface_supported_media=`ifconfig -m $_interface_name | sed -n '
! 		3s/supported media: //p'`
  
! 	set -- `ifconfig $_interface_name | sed -n '
! 		2s/media: \([^ ][^ ]*\).*/\1/p
! 		3s/inet//
! 		3s/--> [0-9.][0-9.]*//
! 		3s/netmask//
! 		3s/broadcast//
! 		3p'`
  
! 	if [ "$1" != "manual" ]; then
  		_interface_mediumtype=$1
  	fi
! 	_interface_ip=$2
! 	_interface_mask=$3
  
  	# Get IP address
  	resp=""		# force one iteration
--- 383,410 ----
  	fi
  
  	_interface_supported_media=`ifconfig -m $_interface_name | sed -n '
! 		/^[ 	]*media autoselect/d
! 		4,$s/[ 	]*media //p'`
  
! 	# get current "media" "ip" and "netmask" ("broadcast")
! 	_t=`ifconfig $_interface_name | sed -n '
! 		s/^[ 	]*media: [^ 	]* \([^ ][^ ]*\).*/\1/p'`
  
! 	if [ "$_t" != "manual" -a "$_t" != "media:" -a "$_t" != "autoselect" ];
! 	then
  		_interface_mediumtype=$1
  	fi
! 
! 	set -- `ifconfig $_interface_name | sed -n '
! 		/^[ 	]*inet/{
! 		s/inet//
! 		s/--> [0-9.][0-9.]*//
! 		s/netmask//
! 		s/broadcast//
! 		p;}'`
! 
! 	_interface_ip=$1
! 	_interface_mask=$2
  
  	# Get IP address
  	resp=""		# force one iteration
*************** configure_ifs() {
*** 424,434 ****
  
  	echo "Your network interface might require explicit selection"
  	echo "of the type of network medium attached. Supported media:"
! 	echo " $_interface_supported_media."
! 	echo -n "Additional media type arguments? [$_interface_mediumtype] "
  	getresp "$_interface_mediumtype"
  	_m=""
! 	if [ "X${resp}" != X"" ]; then
  		_interface_mediumtype=$resp
  		_m="media ${resp}"
  	fi
--- 432,442 ----
  
  	echo "Your network interface might require explicit selection"
  	echo "of the type of network medium attached. Supported media:"
! 	echo "$_interface_supported_media"
! 	echo -n "Additional media type arguments (none)? [$_interface_mediumtype] "
  	getresp "$_interface_mediumtype"
  	_m=""
! 	if [ "X${resp}" != X"" -a "X${resp}" != Xnone ]; then
  		_interface_mediumtype=$resp
  		_m="media ${resp}"
  	fi
*************** configure_ifs() {
*** 438,446 ****
  	echo "directives (like \`link0'). If this is the case you can enter"
  	echo "these at the next prompt."
  	echo ""
! 	echo -n "Additional link-layer arguments? [$_interface_extra] "
  	getresp "$_interface_extra"
! 	if [ "X${resp}" != X"" ]; then
  		_interface_extra=$resp
  	fi
  
--- 446,454 ----
  	echo "directives (like \`link0'). If this is the case you can enter"
  	echo "these at the next prompt."
  	echo ""
! 	echo -n "Additional link-layer arguments (none)? [$_interface_extra] "
  	getresp "$_interface_extra"
! 	if [ "X${resp}" != X"" -a "X${resp}" != Xnone ]; then
  		_interface_extra=$resp
  	fi