diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2008-11-03 12:35:39 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2008-11-03 12:35:39 +0100 |
commit | 88a5e2f6bea02a0f3b6ea32e6e7b4b96d1fbe9b7 (patch) | |
tree | 57d8c69b791cfd32cd0adfb5015b0835a9aad440 /src/core/procedures | |
parent | 08a0a991a5daec785ee7e7148a504249a59e5ea3 (diff) |
big decoupling of flow control from rest in interactive profile + various fixes
Diffstat (limited to 'src/core/procedures')
-rw-r--r-- | src/core/procedures/base~ | 161 | ||||
-rw-r--r-- | src/core/procedures/interactive | 100 |
2 files changed, 238 insertions, 23 deletions
diff --git a/src/core/procedures/base~ b/src/core/procedures/base~ new file mode 100644 index 0000000..74d6c00 --- /dev/null +++ b/src/core/procedures/base~ @@ -0,0 +1,161 @@ +#!/bin/bash + +var_DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3" +var_TARGET_DIR="/mnt" +var_RUNTIME_PACKAGES= +var_PKG_FILE=/home/arch/fifa/runtime/package-list +var_UI_TYPE="cli" # set to cli or dia for dialog + +###### Phases ( can be overridden by more specific procedures) ###### + +phase_preparation () +{ + execute worker select_source + execute worker runtime_network + execute worker runtime_packages +} + + +phase_basics () +{ + execute worker set_clock + execute worker prepare_disks +} + + +phase_system () +{ + execute worker package_list + execute worker install_packages + execute worker auto_fstab #TODO: exact names of these 3 + execute worker auto_network + execute worker auto_locale + execute worker configure_system + execute worker mkinitcpio + execute worker locales + execute worker install_bootloader +} + + +phase_finish () +{ + true +} + + + +###### Workers ( can be overridden by more specific procedures) ###### +worker_select_source () +{ + var_PKG_SOURCE_TYPE='cd' + var_FILE_URL="file:///src/core/pkg" + var_SYNC_URL= + var_MIRRORLIST="/etc/pacman.d/mirrorlist" + # if you override to use ftp (or ask user and he chooses ftp) don't forget to configure the network and to select_mirrors +} + + +worker_runtime_network () +{ + #network is assumed to be functional for now because we do it first with /arch/setup. once that falls away, we'll need to implement it here + true +} + + +worker_runtime_packages () +{ + for pkg in $var_RUNTIME_PACKAGES + do + $PACMAN -Sy --noconfirm --needed $pkg + done +} + + +worker_set_clock () +{ + HARDWARECLOCK=utc + TIMEZONE=`tzselect` + HWCLOCK_PARAMS=" --utc" + if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ] + then + cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime + fi + /sbin/hwclock --hctosys $HWCLOCK_PARAMS --noadjfile + #TODO: user must set date/time and store it +} + + +worker_prepare_disks () +{ + partition # use lib-archboot function by default + # in official installer: autoprepare or diy first partitions, then mountpoints +} + + +# Put the list of packages to be installed in $var_PKG_FILE +worker_package_list () +{ + #TODO: sensible list of packages + true +} + + +worker_install_packages () +{ + target_special_fs on + target_prepare_pacman + [ ! -f $var_PKG_FILE ] && die_error "No package file available!" + PKGLIST=`cat $var_PKG_FILE` + #TODO: what if $var_PKG_FILE is empty? we should die_error because that's probably not what the user wants.. or can it? will pacman complain? + $PACMAN_TARGET -Sy $PKGLIST || die_error "Package installation FAILED." + target_special_fs off +} + + +worker_auto_fstab () +{ + if [ "$S_MKFS" = "1" -o "$S_MKFSAUTO" = "1" ]; then + target_configure_fstab + fi +} + + +worker_auto_network () +{ + [ "$S_DHCP" = 1 ] && target_configure_network dhcp "$PROXY_HTTP" "$PROXY_FTP" + [ "$S_DHCP" != 1 ] && target_configure_network fixed "$PROXY_HTTP" "$PROXY_FTP" +} + + +worker_auto_locale () +{ + target_configure_inital_locale +} + + +worker_configure_system () +{ + #TODO: what to do here? + true +} + + +worker_mkinitcpio () +{ + #TODO:check that this is the right command when projects.archlinux.org is back up + run_mkinitcpio +} + + +worker_locales () +{ + #TODO:what to do here? didn't we already do them? + true +} + + +worker_install_bootlader () +{ + #TODO: ask which disk, install grub on it + true +} diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 1f576da..bd82258 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -1,4 +1,9 @@ #!/bin/sh +depend_procedure core base # esp for auto_{network,locale,fstab} workers + + +# This is a port of the original /arch/setup script. It doesn't use fifa phases but uses it's own menu-based flow (phase) control + TARGET_DIR="/mnt" EDITOR= @@ -44,6 +49,9 @@ start_process () You can view all output from commands by viewing your VC7 console (ALT-F7). \ ALT-F1 will bring you back here." + # menu item tracker- autoselect the next item + NEXTITEM="" + while true do mainmenu @@ -52,14 +60,6 @@ start_process () } -phase_preparation () -{ - #TODO: when does grub device map happen in official installer? - execute worker runtime_packages - notify "Generating GRUB device map...\nThis could take a while.\n\n Please be patient." - get_grub_map -} - mainmenu() { if [ -n "$NEXTITEM" ]; then @@ -80,19 +80,39 @@ mainmenu() NEXTITEM="$(cat $ANSWER)" case $(cat $ANSWER) in "0") - select_source ;; + execute worker select_source ; ret=$? + if [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = "ftp" ]; then + while true; do + DIALOG --menu "FTP Installation" 10 35 3 \ + "0" "Setup Network (Make sure the network is ok before continuing" \ + "1" "Choose Mirror" \ + "2" "Return to Main Menu" 2>$ANSWER + case "$(cat $ANSWER)" in + "0") + execute worker runtime_network && S_NET=1;; + "1") + execute worker select_mirror ;; + *) + break ;; + esac + done + fi + [ $ret -eq 0 ] && S_SRC=1 && execute worker runtime_packages ;; "1") - set_clock ;; + execute worker set_clock && S_CLOCK=1 ;; "2") - prepare_harddrive ;; + execute worker prepare_disks ;; # stage set vars set in the worker "3") - select_packages ;; + execute worker package_list && S_SELECT=1 ;; "4") - installpkg ;; + execute worker install_packages && S_INSTALL=1 && { execute worker auto_fstab; execute worker auto_network; execute worker auto_locale; } ;; "5") - configure_system ;; + execute worker configure_system && S_CONFIG=1 && { execute worker mkinitcpio; execute worker locales; } ;; "6") - install_bootloader ;; + _dia_DIALOG --colors --menu "Which bootloader would you like to use? Grub is the Arch default.\n\n" 10 65 2 \ + "GRUB" "Use the GRUB bootloader (default)" \ + "None" "\Zb\Z1Warning\Z0\ZB: you must install your own bootloader!" 2>$ANSWER + execute worker install_bootloader "`cat $ANSWER`";; "7") echo "" echo "If the install finished successfully, you can now type 'reboot'" @@ -130,11 +150,11 @@ configure_system() run_mkinitcpio target_locale-gen - S_CONFIG=1 + } -prepare_harddrive() +worker_prepare_disks() { S_MKFSAUTO=0 S_MKFS=0 @@ -182,7 +202,7 @@ prepare_harddrive() # params: none set_clock() { - interactive_set_clock && S_CLOCK=1 + interactive_set_clock } #[ $S_SELECT -eq 0 ] && install_pkg && S_INSTALL=1 # user must first select, then install @@ -193,11 +213,23 @@ set_clock() #auto_network #auto_locale +worker_select_source () +{ + #TODO: integrate setup-like source selecter here + var_PKG_SOURCE_TYPE= + var_FILE_URL="file:///src/core/pkg" + var_SYNC_URL= + var_MIRRORLIST="/etc/pacman.d/mirrorlist" + # if you override to use ftp (or ask user and he chooses ftp) don't forget to configure the network and to select_mirrors + interactive_select_source && S_SRC=1 && return 0 + return 1 +} + # select_packages() # prompts the user to select packages to install -select_packages() { +worker_package_list() { # step dependencies if [ $S_SRC -eq 0 ]; then DIALOG --msgbox "You must select an installation source!" 0 0 @@ -210,14 +242,24 @@ select_packages() { DIALOG --yesno "WARNING: Running this stage again will result in the loss of previous package selections.\n\nDo you wish to continue?" 10 50 || return 1 fi - interactive_select_packages && S_SELECT=1 + interactive_select_packages +} + + +worker_install_packages () +{ + if [ $S_SELECT -eq 0 ]; then + DIALOG --msgbox "You must select packages first." 0 0 + return 1 + fi + installpkg && return 0 + return 1 } -# donetwork() # Hand-hold through setting up networking -donetwork() { - interactive_donetwork && S_NET=1 +worker_runtime_network() { + interactive_runtime_network } @@ -226,6 +268,18 @@ dogrub() { } +worker_select_mirror () +{ + interactive_select_mirror +} + +# $1 which one +worker_install_bootloader () +{ + [ "$1" = grub ] && interactive_install_grub && S_BOOT=grub + [ "$1" != grub ] && S_BOOT="$1" +} + # exit if network wasn't configured in installer # if [ $S_NET -eq 0 ]; then # return 1 |