summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-11-11 21:31:00 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-11-11 21:31:00 +0100
commit392e855ceae3fc17584761c79a8d0e5616ed088f (patch)
tree925ed947009493dac3809edcc01a10e958ad2065
parent906aab0e2fb89e5d0ab128239045b82f5cb3c3a4 (diff)
first version of new "dependency" checking and tracking (flow control) in core/interactive + better nextitem setting + tmp_fstab fix
-rw-r--r--TODO2
-rw-r--r--src/core/libs/lib-ui-interactive.sh17
-rw-r--r--src/core/procedures/base4
-rw-r--r--src/core/procedures/interactive22
4 files changed, 31 insertions, 14 deletions
diff --git a/TODO b/TODO
index 07b5d8d..22f64d7 100644
--- a/TODO
+++ b/TODO
@@ -2,7 +2,7 @@ See also the FIXME's and TODO's in the code.
PRE-ALPHA PHASE: get the framework reasonably working + interactive procedure ftp/cdrom working.
-* core/interactive bug: configure system -> fstab (/mnt/etc/fstab) does only contain pts,shm and floppy/dvd/cdrom. not hd's? ->this breaks the boot procedure!
+* core/interactive bug: configure system -> fstab (/mnt/etc/fstab) does only contain pts,shm and floppy/dvd/cdrom. not hd's? ->this breaks the boot procedure! -> fixed i think
* core/interactive bug: grub menu.lst says hda instead of sda
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 123415a..9dc9a93 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -1,6 +1,21 @@
#!/bin/sh
#TODO: get backend code out of here!!
+
+# check if a worker has completed successfully. if not -> tell user he must do it + return 1
+# if ok -> don't warn anything and return 0
+check_depend ()
+{
+ [ -z "$1" -o -z "$2" ] && die_error "Use the check_depend function like this: check_depend <type> <name> with type=phase/worker"
+ [ "$1" != phase -a "$1" != worker ] && die_error "check_depend's first argument must be a valid type (phase/worker)"
+
+ object=$1_$2
+ exit_var=exit_$object
+ [ "${!exit_var}" = '0' ] && return 0
+ show_warning "Cannot Continue. Going back to $2" "You must do $2 first before going here!." && return 1
+}
+
+
interactive_partition() {
target_umountall
@@ -289,7 +304,7 @@ EOF
interactive_mountpoints() {
while [ "$PARTFINISH" != "DONE" ]; do
- : >/$TMP_FSTAB
+ : >$TMP_FSTAB
: >/tmp/.parts
# Determine which filesystems are available
diff --git a/src/core/procedures/base b/src/core/procedures/base
index 09c8bd8..9d31441 100644
--- a/src/core/procedures/base
+++ b/src/core/procedures/base
@@ -99,9 +99,7 @@ worker_install_packages ()
worker_auto_fstab ()
{
- if [ "$S_MKFS" = "1" -o "$S_MKFSAUTO" = "1" ]; then
- target_configure_fstab
- fi
+ target_configure_fstab
}
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index 93aade4..b71049b 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -27,7 +27,10 @@ start_process ()
#####################
## begin execution ##
- # install stages #TODO: now that exit states of all workers are maintained by the execute function, we can probably simplify this
+ #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
+
+ # install stages
S_SRC=0 # choose install medium
S_NET=0 # network configuration
S_CLOCK=0 # clock and timezone
@@ -90,19 +93,19 @@ mainmenu()
fi
[ $ret -eq 0 ] && S_SRC=1 && execute worker runtime_packages ;;
"1")
- execute worker set_clock && S_CLOCK=1 ;;
+ execute worker set_clock && S_CLOCK=1 && NEXTITEM=2;;
"2")
- execute worker prepare_disks ;; # stage set vars set in the worker #TODO: when this is done, default next item is clock?
+ execute worker prepare_disks && NEXTITEM=3;; # stage set vars set in the worker
"3")
- execute worker package_list && S_SELECT=1 ;;
+ check_depend worker prepare_disks && execute worker package_list && S_SELECT=1 && NEXTITEM=4 ;;
"4")
- execute worker install_packages && S_INSTALL=1 && { execute worker auto_fstab; execute worker auto_network; execute worker auto_locale; } ;; #TODO: next item is again install packages
+ check_depend worker package_list && execute worker install_packages && S_INSTALL=1 && { execute worker auto_fstab; execute worker auto_network; execute worker auto_locale; } && NEXITITEM=5 ;;
"5")
- execute worker configure_system && S_CONFIG=1 && { execute worker mkinitcpio; execute worker locales; } ;;
+ check_depend worker install_packages && execute worker configure_system && S_CONFIG=1 && { execute worker mkinitcpio; execute worker locales; } && NEXTITEM=6 ;;
"6")
- execute worker install_bootloader && S_BOOT=1 ;;
+ execute worker install_bootloader && S_BOOT=1 && NEXTITEM=7 ;;
"7")
- notify "If the install finished successfully, you can now type 'reboot' to restart the system." && stop_installer ;;
+ notify "If the install finished successfully, you can now type 'reboot' to restart the system." && stop_installer ;;
*)
ask_yesno "Abort Installation?" && stop_installer ;;
esac
@@ -174,7 +177,8 @@ worker_prepare_disks()
DONE=1 ;;
esac
done
- NEXTITEM="1"
+ [ $S_MKFSAUTO -eq 1 -o $S_MKFS -eq 1 -a $S_PART -eq 1 ] && return 0
+ return 1
}