From a96b41b8b5de90f92f4c909c443d58fd2aac186a Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 11 Nov 2008 22:12:41 +0100 Subject: refactored flow control for disk setup + hopefully bug fixed now --- src/core/libs/lib-ui-interactive.sh | 5 ----- src/core/procedures/interactive | 32 ++++++++++++++------------------ 2 files changed, 14 insertions(+), 23 deletions(-) (limited to 'src/core') diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 0f63320..9b50bd1 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -212,11 +212,6 @@ interactive_autoprepare() # we assume a /dev/hdX format (or /dev/sdX) PART_ROOT="${DEVICE}3" - if [ "$S_MKFS" = "1" ]; then - notify "You have already prepared your filesystems manually" - return 0 - fi - # validate DEVICE if [ ! -b "$DEVICE" ]; then notify "Device '$DEVICE' is not valid" diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index b71049b..32fdf46 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -15,6 +15,7 @@ TIMEZONE= # partitions PART_ROOT= +DISK_CONFIG_TYPE= #will be set to auto or manual # default filesystem specs (the + is bootable flag) # ::[:+] @@ -28,15 +29,12 @@ start_process () ## begin execution ## #TODO: implement check_depend everywhere - #TODO: now that exit states of all workers are maintained by the execute function, we can get rid of this special flow control + #TODO: now that exit states of all workers are maintained by the execute function, we are getting rid of this special flow control # install stages S_SRC=0 # choose install medium S_NET=0 # network configuration S_CLOCK=0 # clock and timezone - S_PART=0 # partitioning - S_MKFS=0 # formatting - S_MKFSAUTO=0 # auto fs part/formatting TODO: kill this S_SELECT=0 # package selection S_INSTALL=0 # package installation S_CONFIG=0 # configuration editing @@ -139,10 +137,9 @@ worker_configure_system() worker_prepare_disks() { - S_MKFSAUTO=0 - S_MKFS=0 - DONE=0 - NEXTITEM="" + DONE=0 + ret=1 # 1 means unsuccessful. 0 for ok + NEXTITEM= while [ "$DONE" = "0" ]; do if [ -n "$NEXTITEM" ]; then DEFAULT="--default-item $NEXTITEM" @@ -150,35 +147,34 @@ worker_prepare_disks() DEFAULT="" fi _dia_DIALOG $DEFAULT --menu "Prepare Hard Drive" 12 60 5 \ - "1" "Auto-Prepare (erases the ENTIRE hard drive)" \ + "1" "Auto-Prepare (erases the ENTIRE hard drive and sets up partitions and filesystems)" \ "2" "Partition Hard Drives" \ "3" "Set Filesystem Mountpoints" \ "4" "Return to Main Menu" 2>$ANSWER NEXTITEM="$(cat $ANSWER)" case $(cat $ANSWER) in "1") - interactive_autoprepare && S_MKFSAUTO=1 ;; + interactive_autoprepare && NEXTITEM=4 && ret=0 && DISK_CONFIG_TYPE=auto;; "2") - if [ "$S_MKFSAUTO" = "1" ]; then - notify "You have already prepared your filesystems with Auto-prepare" + if [ "$DISK_CONFIG_TYPE" = "auto" ]; then + notify "You have already prepared your filesystems with Auto-prepare" #TODO: allow user to do this anyway. he can change his mind. else - interactive_partition && S_PART=1 + interactive_partition && ret=1 && NEXTITEM=3 && DISK_CONFIG_TYPE=manual fi ;; "3") PARTFINISH="" - if [ "$S_MKFSAUTO" = "1" ]; then - notify "You have already prepared your filesystems with Auto-prepare" + if "$DISK_CONFIG_TYPE" = "auto" ]; then + notify "You have already prepared your filesystems with Auto-prepare" #TODO: allow user to do this anyway. he can change his mind. else - interactive_mountpoints && S_MKFS=1 + interactive_mountpoints && ret=0 && NEXTITEM=4 && DISK_CONFIG_TYPE=manual fi ;; *) DONE=1 ;; esac done - [ $S_MKFSAUTO -eq 1 -o $S_MKFS -eq 1 -a $S_PART -eq 1 ] && return 0 - return 1 + return $ret } -- cgit v1.2.3-54-g00ecf