From 26fc8b46047f01ce0cc350d40b56de488ecb5ec3 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 6 Dec 2008 13:50:01 +0100 Subject: several small fixes --- src/core/libs/lib-blockdevices-filesystems.sh | 2 +- src/core/libs/lib-ui-interactive.sh | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index b271900..d285580 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -518,7 +518,7 @@ get_filesystem_program () get_blockdevice_size () { [ -b "$1" ] || die_error "get_blockdevice_size needs a blockdevice as \$1 ($1 given)" - blocks=`fdisk -s $1` + blocks=`fdisk -s $1` || show_warning "Fdisk problem" "Something failed when trying to do 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 392a618..86d5da7 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -303,7 +303,7 @@ interactive_filesystem () fsopts=($FSOPTS); if [ ${#fsopts[*]} -lt 4 ] # less then 4 words in the $FSOPTS string. eg only one option then - notify "Automatically picked ${fsopts[1]}. It's the only option for $part_type blockdevices" + notify "Automatically picked the ${fsopts[1]} filesystem. It's the only option for $part_type blockdevices" fs_type=${fsopts[0]} else default= @@ -341,14 +341,14 @@ interactive_filesystem () do list="$list $pv ON" done - for pv in `grep '+ lvm-pv' $BLOCK_DATA | awk '{print $1}' | sed 's/\+$//'` # find PV's to be added: their blockdevice ends on + and has lvm-pv as type + for pv in `grep '+ lvm-pv' $BLOCK_DATA | awk '{print $1}' | sed 's/\+$//'` # find PV's to be added: their blockdevice ends on + and has lvm-pv as type #TODO: i'm not sure we check which pv's are taken already do grep -q "$pv ON" <<< "$list" || list="$list $pv OFF" done list2=($list) if [ ${#list2[*]} -lt 4 ] # less then 4 words in the list. eg only one option then - notify "Automatically picked PV ${list2[0]}. It's the only available lvm PV" + notify "Automatically picked PV ${list2[0]} to use for this VG. It's the only available lvm PV" fs_params=${list2[0]} else ask_checklist "Which lvm PV's must this volume group span?" $list || return 1 @@ -421,8 +421,9 @@ interactive_filesystems() { menu_list= while read part type label fs do - 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. + infostring="type:$type,label:$label,fs:$fs" + [ -b "$part" ] && get_blockdevice_size ${part/+/} && infostring="size:${BLOCKDEVICE_SIZE}MB,$infostring" # add size in MB for existing blockdevices (eg not for mapper devices that are not yet created yet) + menu_list="$menu_list $part $infostring" #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 _ -- cgit v1.2.3-54-g00ecf