From e03fee6cf554c1408955baa8ebde8ebf1e13c53e Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 18 Dec 2010 12:24:37 +0100 Subject: simplify PV selection a tiny bit by using array directly --- src/core/libs/lib-ui-interactive.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/core/libs') diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 843fd09..2ee3a2c 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -468,22 +468,21 @@ interactive_filesystem () fs_params="$fs_params$pv" fi - list= + list=() for pv in $fs_params do - list="$list $pv ^ ON" + list+=("$pv" ^ ON) done for pv in `grep '+ lvm-pv' $TMP_BLOCKDEVICES | 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" + grep -q "$pv ^ ON" <<< "${list[@]}" || list+=("$pv" - OFF) done - list2=($list) - if [ ${#list2[*]} -lt 6 ] # less then 6 words in the list. eg only one option + if [ ${#list[*]} -lt 6 ] # less then 6 words in the list. eg only one option then - notify "Automatically picked PV ${list2[0]} to use for this VG. It's the only available lvm PV" - fs_params=${list2[0]} + notify "Automatically picked PV ${list[0]} to use for this VG. It's the only available lvm PV" + fs_params=${list[0]} else - ask_checklist "Which lvm PV's must this volume group span?" 0 $list || return 1 + ask_checklist "Which lvm PV's must this volume group span?" 0 "${list[@]}" || return 1 fs_params="${ANSWER_CHECKLIST[@]}" fi fi -- cgit v1.2.3-54-g00ecf