diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 24 | ||||
-rw-r--r-- | src/core/procedures/base | 8 | ||||
-rw-r--r-- | src/core/procedures/interactive | 29 |
3 files changed, 25 insertions, 36 deletions
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 329ef5d..de85d33 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -160,11 +160,9 @@ interactive_time () { # correct timezone. [ "$HARDWARECLOCK" == "localtime" ] && dohwclock $HARDWARECLOCK hctosys - NEXTITEM= while true; do current=$(date) - default=no - [ -n "$NEXTITEM" ] && default="$NEXTITEM" + local default=no #TODO: only propose if network ok EXTRA=() type ntpdate &>/dev/null && EXTRA=('ntp' 'Set time and date using ntp') @@ -177,7 +175,7 @@ interactive_time () { if ntpdate pool.ntp.org >/dev/null then notify "Synced clock with internet pool successfully." - dohwclock $HARDWARECLOCK systohc && NEXTITEM=3 + dohwclock $HARDWARECLOCK systohc && default=3 else show_warning 'Ntp failure' "An error has occured, time was not changed!" fi @@ -187,7 +185,7 @@ interactive_time () { ask_datetime || continue if date -s "$ANSWER_DATETIME" then - dohwclock $HARDWARECLOCK systohc && NEXTITEM=3 + dohwclock $HARDWARECLOCK systohc && default=3 else show_warning "Date/time setting failed" "Something went wrong when doing date -s $ANSWER_DATETIME" fi @@ -201,15 +199,13 @@ interactive_prepare_disks () { DONE=0 local ret=1 # 1 means unsuccessful. 0 for ok - NEXTITEM= 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" while [ "$DONE" = "0" ] do rollbackstr=" (you don't need to do this)" [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && rollbackstr=" (this will revert your last changes)" - default=no - [ -n "$NEXTITEM" ] && default="$NEXTITEM" + 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)" \ @@ -220,16 +216,16 @@ interactive_prepare_disks () case $ANSWER_OPTION in "1") - [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && ask_yesno "You should probably rollback your last changes first, otherwise this will probably fail. Go back to menu to do rollback?" && NEXTITEM=4 && continue - interactive_autoprepare && NEXTITEM=5 && ret=0 && DISK_CONFIG_TYPE=auto;; + [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && ask_yesno "You should probably rollback your last changes first, otherwise this will probably fail. Go back to menu to do rollback?" && default=4 && continue + interactive_autoprepare && default=5 && ret=0 && DISK_CONFIG_TYPE=auto;; "2") - [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && ask_yesno "You should probably rollback your last changes first, otherwise this will probably fail. Go back to menu to do rollback?" && NEXTITEM=4 && continue - interactive_partition && ret=1 && NEXTITEM=3 && DISK_CONFIG_TYPE=manual + [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && ask_yesno "You should probably rollback your last changes first, otherwise this will probably fail. Go back to menu to do rollback?" && default=4 && continue + interactive_partition && ret=1 && default=3 && DISK_CONFIG_TYPE=manual ;; "3") - [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && ask_yesno "You should probably rollback your last changes first, otherwise this will probably fail. Go back to menu to do rollback?" && NEXTITEM=4 && continue + [ "$BLOCK_ROLLBACK_USELESS" = "0" ] && ask_yesno "You should probably rollback your last changes first, otherwise this will probably fail. Go back to menu to do rollback?" && default=4 && continue PARTFINISH="" - interactive_filesystems && ret=0 && NEXTITEM=5 && DISK_CONFIG_TYPE=manual + interactive_filesystems && ret=0 && default=5 && DISK_CONFIG_TYPE=manual ;; "4") interactive_rollback_filesystems;; diff --git a/src/core/procedures/base b/src/core/procedures/base index 099beeb..a7cd382 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -100,16 +100,14 @@ worker_runtime_packages () worker_set_clock () { - NEXTITEM= while true; do - default=no - [ -n "$NEXTITEM" ] && default="$NEXTITEM" + local default=no ask_option $default "Date/time configuration" '' required \ "1" "Select region and timezone" \ "2" "Set time and date" \ "3" "Return to Main Menu" || return 1 - [ "$ANSWER_OPTION" = 1 ] && execute worker interactive_timezone && NEXTITEM=2 - [ "$ANSWER_OPTION" = 2 ] && check_depend worker interactive_timezone && execute worker interactive_time && NEXTITEM=3 + [ "$ANSWER_OPTION" = 1 ] && execute worker interactive_timezone && default=2 + [ "$ANSWER_OPTION" = 2 ] && check_depend worker interactive_timezone && execute worker interactive_time && default=3 [ "$ANSWER_OPTION" = 3 ] && break done } diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index cf2b214..448a273 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -34,9 +34,7 @@ start_process () execute worker intro execute worker sysprep - # menu item tracker- autoselect the next item - NEXTITEM="1" - + default=1 while true do mainmenu @@ -46,8 +44,6 @@ start_process () mainmenu() { - default=no - [ -n "$NEXTITEM" ] && default="$NEXTITEM" menu_workers=(select_source set_editor set_clock prepare_disks package_list install_packages configure_system install_bootloader) menu=() for i in ${!menu_workers[@]} @@ -63,29 +59,29 @@ mainmenu() ask_option $default "MAIN MENU" '' required "${menu[@]}" case $ANSWER_OPTION in "1") - execute worker select_source && execute worker runtime_packages && NEXTITEM=2 ;; + execute worker select_source && execute worker runtime_packages && default=2 ;; "2") - execute worker set_editor && NEXTITEM=3 ;; + execute worker set_editor && default=3 ;; "3") - execute worker set_clock && NEXTITEM=4 ;; + execute worker set_clock && default=4 ;; "4") - execute worker prepare_disks && NEXTITEM=5 ;; + execute worker prepare_disks && default=5 ;; "5") check_depend worker prepare_disks && \ - check_depend worker select_source && execute worker package_list && NEXTITEM=6 ;; + check_depend worker select_source && execute worker package_list && default=6 ;; "6") check_depend worker package_list && \ check_depend worker select_source && execute worker install_packages && { execute worker auto_locale ; \ execute worker auto_keymap_font; - true ; } && NEXTITEM=7 ;; + true ; } && default=7 ;; "7") check_depend worker install_packages && execute worker configure_system && { execute worker mkinitcpio ; \ execute worker locales ; execute worker initialtime ; - true ; } && NEXTITEM=8 ;; + true ; } && default=8 ;; "8") - check_depend worker configure_system && execute worker install_bootloader && NEXTITEM=9 ;; + check_depend worker configure_system && execute worker install_bootloader && default=9 ;; "9") notify "If the install finished successfully, you can now type 'reboot' to restart the system." && stop_installer ;; *) @@ -122,14 +118,13 @@ worker_select_source () select_source_extras_menu () { while true; do - default=no - [ -n "$NEXTITEM" ] && default="$NEXTITEM" + 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" "${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" = 1 ] && execute worker runtime_network && default=2 + [ "$ANSWER_OPTION" = 2 ] && interactive_select_mirror && default=3 [ "$ANSWER_OPTION" = 3 ] && break done return 1 |