diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-04-25 20:56:40 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-04-25 20:56:40 +0000 |
commit | 1ee71a5dac7ddc51409ead3056eb2c53ec0c32e3 (patch) | |
tree | fb5c06b48bc636e281a31073a0457ee69fb84d66 /distrib | |
parent | 4b9628adfab84433777d4dfbcc52a2fe13973b21 (diff) |
stdsize() used to round the sector count to a multiple of 10**3, and
then would multiply by 512 and print the result. This means that, when
printing a partition size, the installer would print sizes rounded to
multiples of 512MB for partitions shorter than a few GB, for example.
Change this to round up one less 10**3 unit, then multiply by 512, then
complete the rounding.
ok krw@ long ago.
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/miniroot/install.sub | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 2001e4e7de4..29a5e86b13a 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.484 2009/04/25 19:25:29 krw Exp $ +# $OpenBSD: install.sub,v 1.485 2009/04/25 20:56:39 miod Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2007 Todd Miller, Theo de Raadt, Ken Westerback @@ -224,7 +224,7 @@ stdsize () { set -- " " K M G T P E Z Y - while (( ${#_sz} > 3 )); do + while (( ${#_sz} > 4 )); do shift _p=${_sz%[0-9][0-9][0-9]} _s=${_sz#$_p} @@ -232,9 +232,16 @@ stdsize () { _sz=$_p done - (( _s > 500 )) && : $(( _sz = _sz + 1 )) + _sz=$(( _sz * 512)) + if (( ${#_sz} > 3 )); then + shift + _p=${_sz%[0-9][0-9][0-9]} + _s=${_sz#$_p} + _s=${_s##+(0)} + _sz=$_p + fi - echo "$(( _sz * 512 )) ${1}Bytes" + echo "${_sz} ${1}Bytes" } # Ask for a password, saving the input in $resp. |