Sat May 29 23:46:14 2021 UTC ()
Handle recent ifconfig(8) outputs in the miniroot installation script.

- Remove netmask slash notation for IP addresses,
  which has been changed between NetBSD 7.x and 8.0:
  http://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/ifconfig/af_inet.c#rev1.24
- Ignore inet6 entries, which miniroot scripts don't support

Should be pulled up to netbsd-9 and netbsd-8.


(tsutsui)
diff -r1.59 -r1.60 src/distrib/miniroot/install.sub

cvs diff -r1.59 -r1.60 src/distrib/miniroot/install.sub (expand / switch to unified diff)

--- src/distrib/miniroot/install.sub 2020/12/12 05:23:21 1.59
+++ src/distrib/miniroot/install.sub 2021/05/29 23:46:14 1.60
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#!/bin/sh 1#!/bin/sh
2# $NetBSD: install.sub,v 1.59 2020/12/12 05:23:21 tsutsui Exp $ 2# $NetBSD: install.sub,v 1.60 2021/05/29 23:46:14 tsutsui Exp $
3# 3#
4# Copyright (c) 1996 The NetBSD Foundation, Inc. 4# Copyright (c) 1996 The NetBSD Foundation, Inc.
5# All rights reserved. 5# All rights reserved.
6# 6#
7# This code is derived from software contributed to The NetBSD Foundation 7# This code is derived from software contributed to The NetBSD Foundation
8# by Jason R. Thorpe. 8# by Jason R. Thorpe.
9# 9#
10# Redistribution and use in source and binary forms, with or without 10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions 11# modification, are permitted provided that the following conditions
12# are met: 12# are met:
13# 1. Redistributions of source code must retain the above copyright 13# 1. Redistributions of source code must retain the above copyright
14# notice, this list of conditions and the following disclaimer. 14# notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright 15# 2. Redistributions in binary form must reproduce the above copyright
@@ -393,28 +393,29 @@ configure_ifs() { @@ -393,28 +393,29 @@ configure_ifs() {
393 /^[ ]*media autoselect/d 393 /^[ ]*media autoselect/d
394 4,$s/[ ]*media //p') 394 4,$s/[ ]*media //p')
395 395
396 # get current "media" "ip" and "netmask" ("broadcast") 396 # get current "media" "ip" and "netmask" ("broadcast")
397 _t=$(ifconfig $_interface_name | sed -n ' 397 _t=$(ifconfig $_interface_name | sed -n '
398 s/^[ ]*media: [^ ]* \([^ ][^ ]*\).*/\1/p') 398 s/^[ ]*media: [^ ]* \([^ ][^ ]*\).*/\1/p')
399 399
400 if [ "$_t" != "manual" ] && [ "$_t" != "media:" ] && [ "$_t" != "autoselect" ]; 400 if [ "$_t" != "manual" ] && [ "$_t" != "media:" ] && [ "$_t" != "autoselect" ];
401 then 401 then
402 _interface_mediumtype=$1 402 _interface_mediumtype=$1
403 fi 403 fi
404 404
405 set -- $(ifconfig $_interface_name | sed -n ' 405 set -- $(ifconfig $_interface_name | sed -n '
406 /^[ ]*inet/{ 406 /^[ ]*inet /{
407 s/inet// 407 s/inet//
 408 s,/[0-9]*,,
408 s/--> [0-9.][0-9.]*// 409 s/--> [0-9.][0-9.]*//
409 s/netmask// 410 s/netmask//
410 s/broadcast// 411 s/broadcast//
411 p;}') 412 p;}')
412 413
413 _interface_ip=$1 414 _interface_ip=$1
414 _interface_mask=$2 415 _interface_mask=$2
415 416
416 # Get IP address 417 # Get IP address
417 resp="" # force one iteration 418 resp="" # force one iteration
418 while [ -z "${resp}" ]; do 419 while [ -z "${resp}" ]; do
419 echo -n "IP address? [$_interface_ip] " 420 echo -n "IP address? [$_interface_ip] "
420 getresp "$_interface_ip" 421 getresp "$_interface_ip"