summaryrefslogtreecommitdiff
path: root/distrib/miniroot
diff options
context:
space:
mode:
authorRobert Peichaer <rpe@cvs.openbsd.org>2013-11-25 23:02:05 +0000
committerRobert Peichaer <rpe@cvs.openbsd.org>2013-11-25 23:02:05 +0000
commita5e5fbade1171949d294937d5ea24e71d5a0319f (patch)
tree781b9eb906ceeddad5f1d08ce73d5bc01daf48e1 /distrib/miniroot
parent10f1362e7c884e0ec6bd6de46df0d116959ddda2 (diff)
Allow auto install/upgrade in non-netbooted case.
Add some logic to get_responsefile() to select an interface for the initial dhcp request which tells what to do (install/upgrade) and where to fetch the responsefile from. - if netbooted, use the interface in netboot group, or - if only one interface exists, use it, or - if more intefaces exist, ask user which one to use Tweak ask_which() to be usable if $auto is true, but $RESPSONSEFILE not yet set. ok halex@ deraadt@
Diffstat (limited to 'distrib/miniroot')
-rw-r--r--distrib/miniroot/install.sub20
1 files changed, 17 insertions, 3 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 69723786d86..8b764ebd240 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.699 2013/11/25 21:51:48 rpe Exp $
+# $OpenBSD: install.sub,v 1.700 2013/11/25 23:02:04 rpe Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
@@ -473,7 +473,7 @@ ask_which() {
# entering something like 'a a'.
isin "$resp" $_dynlist done && break
echo "'$resp' is not a valid choice."
- $auto && exit 1
+ $auto && [[ -n $RESPONSEFILE ]] && exit 1
done
}
@@ -2118,8 +2118,22 @@ get_responsefile() {
# machine was booted via RARP and TFTP.
[[ -x /sbin/dhclient ]] || return
- # Did we do a netboot?
+ # Select network interface for initial dhcp request
_bootdev=$(get_ifdevs netboot)
+ if [[ -z $_bootdev ]]; then
+ set -- $(get_ifdevs)
+ (($#)) || return
+ if (($# == 1)); then
+ _bootdev=$1
+ else
+ while :; do
+ ask_which "network interface" \
+ "should be used for the initial DHCP request" \
+ "$*"
+ isin "$resp" $* && _bootdev=$resp && break
+ done
+ fi
+ fi
[[ -n $_bootdev ]] || return
# Take interface down killing a dhclient from a previous attempt