summaryrefslogtreecommitdiff
path: root/distrib/miniroot/install.sub
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2004-11-28 04:15:10 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2004-11-28 04:15:10 +0000
commit8723b446685dfb46c300b89616a2ef242616ba85 (patch)
treef3708f1ef1bba40a8497246d9f687bffa458d6c2 /distrib/miniroot/install.sub
parenta9cf50d422795cc14d172967caeccbd9e99e0b51 (diff)
When dhcp configuration is attempted add the network interface to a
'dhcp' group . Present 'dhcp' as the default value for the ip address of interfaces in the 'dhcp' group, not the address the previous dhcp configuration might have obtained. Makes it 'safer' to restart installs after network configuration. Suggested by/ok mickey@, ok deraadt@, henning@.
Diffstat (limited to 'distrib/miniroot/install.sub')
-rw-r--r--distrib/miniroot/install.sub20
1 files changed, 13 insertions, 7 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 3f3c2919fce..fc9c1afd24b 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.356 2004/11/11 21:48:06 deraadt Exp $
+# $OpenBSD: install.sub,v 1.357 2004/11/28 04:15:09 krw Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2004 Todd Miller, Theo de Raadt, Ken Westerback
@@ -609,6 +609,7 @@ __EOT
lookup file bind
__EOT
+ ifconfig $_ifs group dhcp >/dev/null 2>&1
dhclient $_ifs
set -- $(v4_info $_ifs)
@@ -629,12 +630,16 @@ __EOT
}
v4_config() {
- local _ifs=$1 _media=$2 _name=$3 _hn=$4 _prompt
-
- set -- $(v4_info $_ifs)
- if [[ -n $2 ]]; then
- ifconfig $_ifs inet $2 delete
- [[ $2 != "0.0.0.0" ]] && { _addr=$2; _mask=$3; }
+ local _ifs=$1 _media=$2 _name=$3 _hn=$4 _prompt _addr _mask
+
+ if ifconfig $_ifs | grep 'groups:.* dhcp' >/dev/null 2>&1; then
+ _addr=dhcp
+ else
+ set -- $(v4_info $_ifs)
+ if [[ -n $2 ]]; then
+ _addr=$2; _mask=$3
+ ifconfig $_ifs inet $_addr delete
+ fi
fi
[[ -x /sbin/dhclient ]] && _prompt=" or 'dhcp'"
@@ -652,6 +657,7 @@ v4_config() {
;;
*) _addr=$resp
ask_until "Netmask?" "${_mask:=255.255.255.0}"
+ ifconfig $_ifs -group dhcp >/dev/null 2>&1
if ifconfig $_ifs inet $_addr netmask $resp up ; then
addhostent "$_addr" "$_name"
echo "inet $_addr $resp NONE $_media" > $_hn