diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2008-12-06 13:25:30 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2008-12-06 13:25:30 +0100 |
commit | ba32e0816e86cbd44db7baa38ef4def7fe806b86 (patch) | |
tree | 611d19316ddd5bce2c12379b46d2055420468b7e /src/core | |
parent | 31a4a4b45fd6184e1d090820010a20aa67abbdfe (diff) |
fix + show size of part in menu
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/libs/lib-blockdevices-filesystems.sh | 13 | ||||
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 6 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index 8e49fbf..b271900 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -510,4 +510,15 @@ get_filesystem_program () [ $1 = lvm-vg ] && echo vgcreate [ $1 = lvg-lv ] && echo lvcreate [ $1 = dm_crypt ] && echo cryptsetup -}
\ No newline at end of file +} + + +# $1 blockdevice +# output will be in $BLOCKDEVICE_SIZE in MB +get_blockdevice_size () +{ + [ -b "$1" ] || die_error "get_blockdevice_size needs a blockdevice as \$1 ($1 given)" + blocks=`fdisk -s $1` + #NOTE: on some interwebs they say 1 block = 512B, on other internets they say 1 block = 1kiB. 1kiB seems to work for me. don't sue me if it doesn't for you + BLOCKDEVICE_SIZE=$(($blocks/1024)) +} diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index dc1dfa3..aa00f5c 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -234,7 +234,8 @@ interactive_filesystem () part_label=$3 # can be empty fs=$4 # can be empty NEW_FILESYSTEM= - [ -b $part ] || die_error "interactive_filesystem \$1 must be a blockdevice! ($part given)" + real_part=${part/+/} # strip away an extra '+' which is used for lvm pv's + [ -b $real_part ] || die_error "interactive_filesystem \$1 must be a blockdevice! ($part given)" if [ -z "$fs" ] then fs_type= @@ -413,7 +414,8 @@ interactive_filesystems() { menu_list= while read part type label fs do - menu_list="$menu_list $part (type:$type,label:$label,fs:$fs)" #don't add extra spaces, dialog doesn't like that. + get_blockdevice_size ${part/+/} + menu_list="$menu_list $part size:${BLOCKDEVICE_SIZE}MB,type:$type,label:$label,fs:$fs" #don't add extra spaces, dialog doesn't like that. done < $BLOCK_DATA ask_option no "Manage filesystems, block devices and virtual devices. Note that you don't *need* to specify opts, labels or extra params if you're not using lvm, dm_crypt, etc." $menu_list DONE _ |