From d487df8c9ecf58af3ab46e7f2b898a9b4f6ba097 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 12 Dec 2010 20:33:15 +0100 Subject: make BLOCKFRIENDLY prettier use arrays, so we can allow whitespace in the labels --- src/core/libs/lib-ui.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/libs/lib-ui.sh') diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index f31031a..ef0e092 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -38,16 +38,16 @@ printk() # Get a list of available partionable blockdevices for use in ask_option -# populates $BLOCKFRIENDLY with entries like: -# /dev/sda /dev/sda_640133_MiB_(640_GiB) +# populates array $BLOCKFRIENDLY with elements like: +# '/dev/sda' '/dev/sda 640133 MiB (640 GiB)' listblockfriendly() { - BLOCKFRIENDLY= + BLOCKFRIENDLY=() for i in $(finddisks) do get_blockdevice_size $i MiB - [ -n "$BLOCKFRIENDLY" ] && BLOCKFRIENDLY="$BLOCKFRIENDLY " - BLOCKFRIENDLY="$BLOCKFRIENDLY$i ${i}_${BLOCKDEVICE_SIZE}_MiB_($(($BLOCKDEVICE_SIZE/2**10))_GiB)" + size_GiB=$(($BLOCKDEVICE_SIZE/2**10)) + BLOCKFRIENDLY+=($i "$i ${BLOCKDEVICE_SIZE} MiB ($size_GiB GiB)" done } -- cgit v1.2.3-54-g00ecf