From 65679f839e6b7f1a136d1e7359fc67a029cae717 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 29 Dec 2010 16:38:21 +0100 Subject: refactor select_source,networking workers * give base/automatic procedures more elegant select_source, runtime_network workers * make select_mirrors part of select_source, no need to have it a worker * "select source" extras (including runtime_network and interactive_select_mirror) are specific to the interactive procedure, so make it part of interactive's select_source worker. * interactive worker_select_source has no problems being run multiple times --- src/core/procedures/interactive | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src/core/procedures/interactive') diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index a01e13d..cf2b214 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -18,7 +18,6 @@ declare -A workertitles workertitles['select_source']='Select source' workertitles['set_editor']='Set editor' workertitles['runtime_network']='Setup network' -workertitles['select_mirror']='Select mirror' workertitles['set_clock']='Set clock' workertitles['prepare_disks']='Prepare hard drive(s)' workertitles['package_list']='Select packages' @@ -64,8 +63,7 @@ mainmenu() ask_option $default "MAIN MENU" '' required "${menu[@]}" case $ANSWER_OPTION in "1") - execute worker select_source; local ret=$?; [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = net ] && execute worker select_source_extras_menu - [ $ret -eq 0 ] && execute worker runtime_packages && NEXTITEM=2 ;; + execute worker select_source && execute worker runtime_packages && NEXTITEM=2 ;; "2") execute worker set_editor && NEXTITEM=3 ;; @@ -111,8 +109,29 @@ worker_prepare_disks() worker_select_source () { - #TODO: how to handle user going here again? discard previous settings, warn him that he already done it? - interactive_select_source && return 0 + interactive_select_source + local ret=$?; + if [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = net ] + then + select_source_extras_menu || ret=$? + fi + # base/automatic procedure run a worker runtime_repositories, maybe we could do an interactive repo adder + return $ret +} + +select_source_extras_menu () +{ + while true; do + default=no + [ -n "$NEXTITEM" ] && default="$NEXTITEM" + ask_option $default "NET (HTTP/FTP) Installation" "Make sure the network is ok and you've selected a mirror before continuing the installer" required \ + "1" "${worker_titles['runtime_network']}" \ + "2" "Select mirror" \ + "3" "Return to Main Menu" || return 1 + [ "$ANSWER_OPTION" = 1 ] && execute worker runtime_network && NEXTITEM=2 + [ "$ANSWER_OPTION" = 2 ] && interactive_select_mirror && NEXTITEM=3 + [ "$ANSWER_OPTION" = 3 ] && break + done return 1 } @@ -161,13 +180,6 @@ worker_runtime_network() { interactive_runtime_network } - -worker_select_mirror () -{ - interactive_select_mirror -} - - worker_install_bootloader () { interactive_install_bootloader -- cgit v1.2.3-54-g00ecf