diff options
author | 2013-11-25 23:02:04 +0000 | |
---|---|---|
committer | 2013-11-25 23:02:04 +0000 | |
commit | abe8027bb0a2b16bbe4cde6a3e5b1d6de90b6afd (patch) | |
tree | 1bdc564dfe9b56930c945a21e0364a4c7e46cf9f | |
parent | Rework _autorespond() (diff) | |
download | wireguard-openbsd-abe8027bb0a2b16bbe4cde6a3e5b1d6de90b6afd.tar.xz wireguard-openbsd-abe8027bb0a2b16bbe4cde6a3e5b1d6de90b6afd.zip |
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@
-rw-r--r-- | distrib/miniroot/install.sub | 20 |
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 |