summaryrefslogtreecommitdiff
path: root/src/core/libs/lib-ui.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-02-22 19:43:58 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2009-02-22 19:43:58 +0100
commit0fb2a618b05a4cc69a8036ba93e07943289fd5dd (patch)
tree8d048fdfe2816f4d02d021c0dce60cd8de53cd53 /src/core/libs/lib-ui.sh
parent2f5c33119f7fee05db9edc44cf37d90c50ccefa6 (diff)
cleanup in blockdevice size stuff. correct usage of units etc. inspired by FS#12949 - "hdparm -I" fails in VMware 0001-Using-fdisk-instead-of-hdparm-to-get-disc-capacity.patch
Diffstat (limited to 'src/core/libs/lib-ui.sh')
-rw-r--r--src/core/libs/lib-ui.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh
index 0664817..3a40eb2 100644
--- a/src/core/libs/lib-ui.sh
+++ b/src/core/libs/lib-ui.sh
@@ -129,14 +129,17 @@ printk()
# TODO: pass disks as argument to decouple backend logic
-# Get a list of available disks for use in the "Available disks" dialogs. This
-# will print the disks as follows, getting size info from hdparm:
-# /dev/sda: 640133 MBytes (640 GB)
-# /dev/sdb: 640135 MBytes (640 GB)
+# Get a list of available disks for use in the "Available disks" dialogs.
+# Something like:
+# /dev/sda: 640133 MB (640 GB)
+# /dev/sdb: 640135 MB (640 GB)
_getavaildisks()
{
- # NOTE: to test as non-root, stick in a 'sudo' before the hdparm call
- for i in $(finddisks); do echo -n "$i: "; hdparm -I $i | grep -F '1000*1000' | sed "s/.*1000:[ \t]*\(.*\)/\1/"; echo "\n"; done
+ for i in $(finddisks)
+ do
+ get_blockdevice_size $i MB
+ echo "$i: $BLOCKDEVICE_SIZE MB ($(($BLOCKDEVICE_SIZE/1000)) GB)\n"
+ done
}