From 3bcc4ec8d835893505294fe5b5335f3cbd2ea1b8 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 31 Dec 2010 15:29:59 +0100 Subject: fix/improve default/next entry setting in menu's * bugfix for commit e5e4eec43cc04cd99648c8b6826af4b9e5c58b10 * simplyfying default setting in 3 places as well --- src/core/libs/lib-ui-interactive.sh | 13 +++++-------- src/core/procedures/base | 2 +- src/core/procedures/interactive | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 2aea25b..1e95672 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -180,9 +180,9 @@ interactive_time () { # correct timezone. [ "$HARDWARECLOCK" == "localtime" ] && dohwclock $HARDWARECLOCK hctosys + local default=no while true; do current=$(date) - local default=no #TODO: only propose if network ok EXTRA=() type ntpdate &>/dev/null && EXTRA=('ntp' 'Set time and date using ntp') @@ -221,11 +221,11 @@ interactive_prepare_disks () local ret=1 # 1 means unsuccessful. 0 for ok DISK_CONFIG_TYPE= [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && show_warning "Rollback may be needed" "It seems you already went here. You should probably rollback previous changes before reformatting, otherwise stuff will probably fail" + local default=no while [ "$DONE" = "0" ] do rollbackstr=" (you don't need to do this)" [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && rollbackstr=" (this will revert your last changes)" - local default=no ask_option $default "Prepare Hard Drive" '' required \ "1" "Auto-Prepare (erases an ENTIRE hard drive and sets up partitions, filesystems and mountpoints)" \ @@ -474,14 +474,12 @@ interactive_filesystem () # ask label, if relevant if [ "$fs_create" == yes ] && check_is_in "$fs_type" "${fs_label_mandatory[@]}" then - default= - [ -n "$fs_label" ] && default="$fs_label" + default="$fs_label" # can be empty ask_string "Enter the label/name for this $fs_type on $part (Mandatory for this type of FS!)" "$default" || return 1 #TODO: check that you can't give LV's labels that have been given already or the installer will break. fs_label=$ANSWER_STRING elif [ "$fs_create" == yes ] && check_is_in "$fs_type" "${fs_label_optional[@]}" then - default= - [ -n "$fs_label" ] && default="$fs_label" + default="$fs_label" # can be empty ask_string "Enter the label for this $fs_type on $part (optional) [keep it short and don't use spaces]" "$default" 0 fs_label=${ANSWER_STRING// } # strip spaces to prevent problems in our bash code and to keep things simple. fi @@ -535,8 +533,7 @@ interactive_filesystem () # ask opts if [ "$fs_create" == yes ] then - default= - [ -n "$fs_opts" ] && default="$fs_opts" + default="$fs_opts" # can be empty program="${filesystem_programs[$fs_type]}" ask_string "Enter any additional opts for $program" "$default" 0 fs_opts="$ANSWER_STRING" diff --git a/src/core/procedures/base b/src/core/procedures/base index 68a91ee..b6f0ea4 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -96,8 +96,8 @@ worker_runtime_packages () worker_set_clock () { + local default=no while true; do - local default=no ask_option $default "Date/time configuration" '' required \ "1" "Select region and timezone" \ "2" "Set time and date" \ diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 52faa44..bfb13ff 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -105,8 +105,8 @@ worker_select_source () select_source_extras_menu () { + local default=no while true; do - local default=no 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" "${workertitles['runtime_network']}" \ "2" "Select mirror" \ -- cgit v1.2.3-54-g00ecf