summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/action/update.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/action/update.sh b/src/action/update.sh
index d18c029..5db6230 100644
--- a/src/action/update.sh
+++ b/src/action/update.sh
@@ -17,9 +17,46 @@
do_update()
{
+ local dists=''
+ local i=0
+ local dist=''
+ local mirror_url=''
+ local mirror_label=''
+ local mirror_urls=''
+
info 'Updating firmware'
+ # Probe for board and chip.
if ! flashrom_probe; then
return 1
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})
+ i=$(($i + 1))
+ dist="$(printf '%s ' ${dists} | cut -d ' ' -f ${i})"
+ else
+ dist="$(printf '%s' ${dists})"
+ 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
+ break
+ fi
+ mirror_urls="${mirror_urls} ${mirror_url}"
+ set -- "${@}" "${mirror_label}"
+ done <<-EOF
+ $(dist_get_mirrors)
+ EOF
+ show_menu 'Select a mirror' "${@}"
+
+ return 0
}