diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-05-09 17:32:08 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-05-09 17:32:08 +0000 |
commit | 1d9c32366bb9203dd905f56a6fe12d3689ea21a6 (patch) | |
tree | 7f3e3e0c83501a882983c92a43f8725b2e8b12a1 /distrib | |
parent | e56d69b18667866282363cb635c2cbddd927bc36 (diff) |
Shuffle code to make v4_config() and v6_config() look even
more like each other.
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/miniroot/install.sub | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 8cf7eee7b8e..4509641587c 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1124 2019/05/09 16:59:25 krw Exp $ +# $OpenBSD: install.sub,v 1.1125 2019/05/09 17:32:07 krw Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -1044,10 +1044,10 @@ v4_config() { return fi ;; - *) _addr=$resp - ;; esac + _addr=$resp + # Ask for the netmask if the user did not use CIDR notation. if [[ $_addr == */* ]]; then _mask= @@ -1060,11 +1060,9 @@ v4_config() { echo "inet $_addr $_mask" >>$_hn add_hostent "${_addr%%/*}" "$_name" break - else - _addr= - _mask= - $AI && exit 1 fi + _addr= + $AI && exit 1 done } @@ -1145,21 +1143,21 @@ v6_config() { echo "inet6 autoconf" >>$_hn return ;; - *) _addr=${resp%%/*} - if [[ $resp == */* ]]; then - _prefixlen=${resp##$_addr/} - else - ask_until "IPv6 prefix length for $_if?" "64" - _prefixlen=$resp - fi - if ifconfig $_if inet6 $_addr/$_prefixlen up; then - echo "inet6 $_addr $_prefixlen" >>$_hn - add_hostent "$_addr" "$_name" - return - fi - ;; esac + _addr=${resp%%/*} + if [[ $resp == */* ]]; then + _prefixlen=${resp##$_addr/} + else + ask_until "IPv6 prefix length for $_if?" "64" + _prefixlen=$resp + fi + if ifconfig $_if inet6 $_addr/$_prefixlen up; then + echo "inet6 $_addr $_prefixlen" >>$_hn + add_hostent "$_addr" "$_name" + return + fi + $AI && exit 1 done } |