From 6e91cf0fdc0d4236e1ff91969dcd042f0b7907fb Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 27 Oct 2015 20:50:51 -0400 Subject: do_update(): Show distributor names in menu --- (limited to 'src/action') diff --git a/src/action/update.sh b/src/action/update.sh index 3d897bc..7cbfcf3 100644 --- a/src/action/update.sh +++ b/src/action/update.sh @@ -17,7 +17,7 @@ do_update() { - local dists='' + local dist_ids='' local i=0 local dist='' local mirror_url='' @@ -32,20 +32,22 @@ do_update() fi # Select distributor. - # TODO: Show names in menu labels. - dists="$(board_get_dists)" - if [ $(printf '%s' "${dists}" | wc -w | cut -d ' ' -f 1) -gt 1 ]; then - i=$(show_menu 'Select a firmware distributor' ${dists}) + dist_ids="$(board_get_dists)" + if [ $(printf '%s' "${dist_ids}" | wc -w | cut -d ' ' -f 1) -gt 1 ]; then + set -- + for dist_id in ${dist_ids}; do + set -- "${@}" "$(dist_get_name "${dist_id}")" + done + i=$(show_menu 'Select a firmware distributor' "${@}") i=$(($i + 1)) - dist="$(printf '%s ' ${dists} | cut -d ' ' -f ${i})" + dist="$(printf '%s ' ${dist_ids} | cut -d ' ' -f ${i})" else - dist="$(printf '%s' ${dists})" + dist="$(printf '%s' ${dist_ids})" fi select_dist "${dist}" info 'Distributor: %s' "${dist}" # Select mirror. - # TODO: Handle show_menu() output. set -- while :; do if ! read -r mirror_url || ! read -r mirror_label; then -- cgit v0.9.1