diff options
author | Alexander Hall <halex@cvs.openbsd.org> | 2012-07-09 10:51:11 +0000 |
---|---|---|
committer | Alexander Hall <halex@cvs.openbsd.org> | 2012-07-09 10:51:11 +0000 |
commit | 07db3d3d0d3d0e93ace580de821bc69cbfe14404 (patch) | |
tree | b16ae7d8f1eb0cb78318825b0567f9ad16f8dc3e | |
parent | b327c153ce349ba1fa199f65b23d983e376fb657 (diff) |
when being asked which disk to install on, give the user the chance to
see some details for each device.
"Lovely" deraadt@ and some more ok's on previous similar versions
-rw-r--r-- | distrib/miniroot/install.sub | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index f40995bbb5e..2059671a77e 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.658 2012/07/08 10:10:18 halex Exp $ +# $OpenBSD: install.sub,v 1.659 2012/07/09 10:51:10 halex 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 @@ -2117,11 +2117,31 @@ if [[ $MODE == install ]]; then echo fi +# Show device name, label and size for the provided list of devices +diskinfo() { + local _d + for _d; do + makedev $_d + echo -n "$_d: " + disklabel -dpg $_d 2>/dev/null | + sed -e '/^label: /{s,,,;s/ *$//;s/^$/<no label>/;H;d;}' \ + -e '/.*# total bytes: \(.*\)/{s//(\1)/;H;}' \ + -e '$!d;x;s/\n/ /' + rm -f /dev/{r,}$_d? + done +} + # Get ROOTDISK, ROOTDEV and SWAPDEV. while :; do - ask_which "disk" "is the root disk" '$(get_dkdevs | sed s,^$,none, )' - [[ $resp == done ]] && exit - [[ $resp != none ]] && break + echo "Available disks are: $(get_dkdevs | sed 's/^$/none/')." + _ask "Which disk is the root disk? ('?' for details)" \ + $(get_dkdevs | sed 's/ .*//') || continue + case $resp in + "?") diskinfo $(get_dkdevs);; + '') ;; + *) isin "$resp" $(get_dkdevs) && break + echo "no such disk";; + esac done makedev $resp || exit |