summaryrefslogtreecommitdiff
path: root/distrib/miniroot/install.sub
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-01-01 22:53:40 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-01-01 22:53:40 +0000
commitd208912d1f96cea6488bc2763de7e993a7b15075 (patch)
treeb3721929c7df2d03544177e529593db39b7767d0 /distrib/miniroot/install.sub
parent5107536e16b39db9f3d83d36046f2d1fd3dc78ac (diff)
Enable 'ifconfig -C' (list dynamic interface types) on install
media. Use this feature in install scripts to eliminate manually maintained list of dynamic interface types. '-C' brought to my attention by reyk@, tweaks to install script to use -C in get_ifdevs() from rpe@. ok rpe@ deraadt@
Diffstat (limited to 'distrib/miniroot/install.sub')
-rw-r--r--distrib/miniroot/install.sub44
1 files changed, 19 insertions, 25 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index b45ad8e0172..3035282cce2 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.803 2014/12/29 17:04:19 deraadt Exp $
+# $OpenBSD: install.sub,v 1.804 2015/01/01 22:53:39 krw Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
# All rights reserved.
@@ -161,9 +161,12 @@ get_cddevs () {
}
get_ifdevs() {
- ifconfig "$@" 2>/dev/null |
- egrep -v '^[[:space:]]|(bridge|enc|gif|gre|lo|pflog|pfsync|ppp|tun)[[:digit:]]+:' |
- sed -n 's/^\(.*\):.*/\1/p'
+ local _if _iflist=$(ifconfig -C)
+
+ for _if in $(ifconfig "$@" 2>/dev/null |
+ sed -n 's/^\([^[:space:]]*\):.*/\1/p'); do
+ isin ${_if%%[0-9]*} $_iflist || echo $_if
+ done
}
get_drive() {
@@ -1125,28 +1128,19 @@ enable_network() {
for hn in /mnt/etc/hostname.*; do
# Strip off prefix to get interface name.
if=${hn#/mnt/etc/hostname.}
- # Check for ifconfig'able interface.
- (ifconfig $if||ifconfig $if create) >/dev/null 2>&1 || continue
- # Don't immediately do interfaces constructed from others.
- # Skip uninteresting devices.
- case ${if%%[0-9]*} in
- trunk) _trunks="$_trunks $hn"
- continue
- ;;
- svlan) _svlans="$_svlans $hn"
- continue
- ;;
- vlan) _vlans="$_vlans $hn"
- continue
- ;;
- bridge|carp|enc|gif|gre|lo|pflog|pfsync|ppp|tun)
- continue
- ;;
- esac
- # Now parse the hostname.* file
- ifstart $hn
+ if isin ${if%%[0-9]*} $(ifconfig -C); then
+ # Dynamic interfaces must be done later.
+ case ${if%%[0-9]*} in
+ trunk) _trunks="$_trunks $hn" ;;
+ svlan) _svlans="$_svlans $hn" ;;
+ vlan) _vlans="$_vlans $hn" ;;
+ esac
+ else
+ # 'real' interfaces (if available) are done now.
+ ifconfig $if >/dev/null 2>&1 && ifstart $hn
+ fi
done
- # Configure any constructed interfaces now that 'real' ones are up.
+ # Configure any dynamic interfaces now that 'real' ones are up.
# ORDER IS IMPORTANT! (see /etc/netstart)
for hn in $_trunks $_svlans $_vlans; do
ifstart $hn