diff options
-rw-r--r-- | Makefile | 23 | ||||
-rw-r--r-- | README | 196 | ||||
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | examples/generic-install-on-sda | 9 | ||||
-rwxr-xr-x | src/aif.sh | 2 | ||||
-rwxr-xr-x | src/core/libs/lib-flowcontrol.sh | 7 | ||||
-rw-r--r-- | src/core/libs/lib-software.sh | 17 | ||||
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 97 | ||||
-rw-r--r-- | src/core/procedures/automatic | 1 | ||||
-rw-r--r-- | src/core/procedures/base | 6 | ||||
-rw-r--r-- | src/core/procedures/interactive | 106 | ||||
-rw-r--r-- | testplan | 19 |
12 files changed, 300 insertions, 189 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..61a524c --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +all: install + +install: + install -d $(DESTDIR)/sbin + install -d $(DESTDIR)/usr/share/aif/docs + install -d $(DESTDIR)/usr/share/aif/examples + install -d $(DESTDIR)/usr/lib/aif/core + install -d $(DESTDIR)/usr/lib/aif/user + install -D -m755 src/aif.sh $(DESTDIR)/sbin/aif + install -D -m644 HOWTO $(DESTDIR)/usr/share/aif/docs + install -D -m644 README $(DESTDIR)/usr/share/aif/docs + cp -rp src/core $(DESTDIR)/usr/lib/aif + chmod -R 755 $(DESTDIR)/usr/lib/aif/core + cp -rp src/user $(DESTDIR)/usr/lib/aif + chmod -R 755 $(DESTDIR)/usr/lib/aif/user + cp -rp examples $(DESTDIR)/usr/share/aif + chmod -R 755 $(DESTDIR)/usr/share/aif/examples + + +uninstall: + rm -f $(DESTDIR)/sbin/aif + rm -rf $(DESTDIR)/usr/share/aif + rm -rf $(DESTDIR)/usr/lib/aif @@ -1,21 +1,40 @@ AIF is the Arch Linux Installation Framework. ---- Beta software. Use at own risk!! --- - - License: GPL3. See COPYING. -Author: Dieter Plaetinck +Authors: Dieter Plaetinck + Quite some code has been taken from the installer project @ http://projects.archlinux.org/?p=installer.git;a=summary + The main authors/contributors of that project are Judd Vinet, Tobias Powalowski, Simo Leone, Aaron Griffin and Dan McGee Homepage: http://github.com/Dieterbe/aif -** --> Intro / Current state of things <-- ** -AIF is included on the 2009.02 Arch install CD's as an experimental alternative for the old installer (/arch/setup). -AIF is based on the old installer, but the code has been madly refactored, reorganized, cleaned up and in some places replaced. +** Goals ** + +The goal of this project is to: +1) provide reasonable clean, DRY, modular and maintainable code for the Arch Linux installer +2) provide complete, easily-reusable libraries for disk partitioning, UI, package management, etc +3) provide some sensible default installation methods (eg interative, automatic (prescripted), ..) +4) allow power users to easily override certain aspects of the installation procedures + or creating customized procedures, leveraging the available code. + +The goal of AIF is not (yet) to: +1) provide an installer who detects your stuff and tries to be smart and configures all your stuff. + If you're interested in this, feel free to build it and I may incorporate it someday. +2) be more fancy then needed -AIF comes by default with these procedures: -- interactive: A port of /arch/setup. Should work okay if you don't try too hard to break it ;-) -- automatic: An automated, deploy-tool-alike procedure. Work in progress. Don't use this yet. + + +** A bit of history ** + +AIF is based on the old archlinux-installer (/arch/setup), but the code has been madly refactored, reorganized, cleaned +up, improved and in some places replaced. +The initial goal was to build an automated installer with a reusable +backend, but the porting of the userfriendly, interactive installer from /arch/setup quickly became a proof of concept +and even main focus point. See http://www.nabble.com/Fifa:-Flexible-Installer-Framework-for-Arch-linux-td20256427.html + + + +** /arch/setup vs AIF ** AIF may or may not bring much additional value for you when compared with the previous installer, it depends on what you want to do: @@ -24,7 +43,8 @@ installer, it depends on what you want to do: The features are more or less the same, with a few exceptions: * Different partition/filesystem editor offering more flexibility and options, such as support for LVM and dm_crypt * Rollback functionality if you change your mind after having formatted filesystems or if something went wrong and you want to retry. - * Some miscellaneous features like the ability to choose between ncurses and CLI mode, debug output, and logging to a file. + * Some miscellaneous features like the ability to choose between ncurses and CLI mode, + nicer date/time setting, auto updating some config files, debug output, logging to a file etc. - Hackers: The code base that AIF runs on is very usable for hacking. The code is modular, reusable and quite complete. If you want to build your own @@ -33,94 +53,125 @@ installer, it depends on what you want to do: works. It is built for hacking, reusing code, changing the behaviour in specific places and making writing custom installers as easy as possible. -Keep in mind that AIF is still in beta phase. -There are some known issues (see the TODO file and various TODO's in the source code) -If you encounter issues, please report them at the Arch Linux bugtracker under the "Release Engineering" project. -( http://bugs.archlinux.org/toplevel/proj6 ) -You can also get in touch with the release engineers / aif developers on the arg-releng -mailing list, http://www.archlinux.org/mailman/listinfo/arch-releng +** Bug/feature request tracking. Getting in touch ** -AIF will soon become the new official installer so go ahead and try it ! +AIF developement happens under the umbrella of the release engineering project of Arch Linux. +- bug tracker: the Arch Linux bugtracker, "Release Engineering" project, category 'AIF'. + http://bugs.archlinux.org/toplevel/proj6 +- mailing list: http://www.archlinux.org/mailman/listinfo/arch-releng +There are some known issues (see the bugtracker, TODO file and various TODO's in the source code) +If you encounter issues, please report them on the bugtracker, after checking if they are not reported yet of course. +If you want to get in touch with us, to ask/discuss/.. things, please send to the mailing list. -** Goals ** -The goal of this project is -1) to make the code of the Arch Linux installer more clean, DRY, modular and maintainable. -2) providing complete, easily-reusable libraries for disk partitioning, UI, package management, etc -3) provide some sensible default installation methods (eg interative, automatic (prescripted), ..) -4) allowing power users to easily override certain aspects of the installation procedures - or creating customized procedures, leveraging the available code. -The goal of AIF is not (yet): -1) providing an installer who detects your stuff and tries to be smart and configures all your stuff. - If you're interested in this, feel free to build it and I may incorporate it someday. +** Lingo ** +- procedure = a 'plugin' for aif that controls how the installation advances and how the interaction with the user happens +- lib = a library for aif with some useful functions (eg lib-pacman handles all pacman related things) +- module = a bundle that can contain zero or more procedures and libraries. +- profile = a fancier name for a config file. some procedures support the use of profiles (eg automatic), others don't (eg interactive) +- partial procedure = a 'mini' procedure that lets the user perform one or more smaller aspects of (or related to) an installation -** File locations (on the install CD): ** +** Basic workflow ** +AIF comes by default with these procedures: +- base: basic, little-interactivity installation with some common defaults. + This procedure is used by the others to inherit from, it is NOT meant to be used directly by end users +- interactive: An interactive installation procedure, modeled after /arch/setup + Asks you some questions, guides you through an installation + and even helps you a bit by updating configuration files on the target + system with your usettings +- automatic: An automated, deploy-tool-alike procedure. designed for low- + to zero interactivity. uses profiles for configuration of the installation/target system. + See /usr/share/aif/examples/ for example profile files. +- partial-configure-network: exposes the network configuration step from the interactive procedure +- partial-disks: Process disk subsystem or do a rollback +- partial-keymap: change your keymap/console font settings. The benefit of this method over a simple loadkeys is that the interactive procedure will + automatically update the rc.conf on the target system with your settings. + +You would usually invoke aif like this: +aif -p interactive +aif -p automatic -c <profile file> [-l] +aif -p <custom module name>/<your procedure> +Type `aif -h` or just aif to see more details. + + + +** Packages and file locations: ** + +The officially supported package is aif, in extra. There are also +unsupported development git packages in AUR. See HOWTO + +File locations: * aif.sh -> /sbin/aif * docs -> /usr/share/aif/docs * core module -> /usr/lib/aif/core * user modules -> /usr/lib/aif/user/<module name> (put your own modules here) -* runtime files -> /tmp/aif (package list etc go here) +* runtime files -> /tmp/aif * logs -> /var/log/aif -A module can have 2 directories: libs, and procedures. - - -** Procedures ** -core/base: basic, little-interactivity installation with some common defaults. You probably don't - want to run this one, although it's useful for other procedures to inherit from. -core/interactive: interactive, reasonably flexible/featured installer (port of /arch/setup) -core/automatic: automatic installer/deployment tool, can use config files - -** Partial Procedures ** -These procedures allow you to run a select few functions, in order to reach -a specific goal, usually not installing a system - -partial-configure-network.sh Configure network on the runtime system -partial-disks.sh Process disk subsystem or do a rollback ** (Internal) Workflow ** There is a very basic but powerful workflow defined by variables, phases and workers. Depending on the procedure you choose (or write yourself), these will differ In the code, they are very recognizable and are named like this: - - variable -> var_<foo> + - variable -> var_<FOO> - phase -> phase_<bar> (an array in which each element is a worker to be executed, with optionally arguments for that worker) There are 4 phases: preparation, basics, system, finish. (executed in that order) - worker -> worker_<baz> ( a worker function, called by a phase. implements some specific logic. eg runtime_packages, prepare_disks, package_list etc) + You can depend on whatever procedure you like (like core/base), to save yourself some work (you only need to override a few things) Notes: - - The phases are started by the start_process function. You can also override this function to take flow control in your own hands (eg iterative, menu-based installer) + - You don't need to use the concept of phases, for example the interactive procedure doesn't use them. + - The phases are started by the start_process function. You can also override this function to take flow control in your own hands (like interactive does) - you _can_ override _all_ variables and functions in your modules, but you should be able to achieve your goals by overriding only the 3 basic things and the start_process function, and only in procedures. - you _must_ specify a procedure, to avoid errors. take 'interactive' if unsure - don't edit the base procedure (or any other core item), rather make your own. It's easy! - you're not supposed to define new phases. just override them. logic goes in workers/libariers -Modules are the building blocks in aif. They can contain libraries (for -user interfaces, backend logic, etc) and procedures (how an installation -process should go). -The core module comes by default and contains everything 99% of the users -will need. You can easily make your own modules with in it your own -procedures (and your own libraries, if you need that). If you build your -own libraries, it's generally a good idea to keep -their names in line with what core has (lib-ui.sh, lib-network.sh etc). -Do not put stuff in the core module yourself! If it's good stuff, it might -be merged into core someday... Also, don't name your custom module 'core' (it will be -ignored anyway). Don't call it http either, because you can specify -'http://some/path/to/a/procedure', aif will download that procedure and -execute it (and the module will be 'http') + + +** Extending AIF ** + +*** Modules *** + -> Modules are the building blocks in aif + -> user modules are just directories with a 'libs' and 'procedures' subdirectory + where you can put your customized.. guess what. See 'file locations' + -> The core module comes by default and contains everything 99% of the users will need. + Don't name your custom module 'core' (it will be ignored). + Don't call it http either, because you can specify 'http://some/path/to/a/procedure', + aif will download that procedure and execute it (and the module will be 'http') + +*** Procedures *** + -> You can take a procedure, copy it, modify it and call it. that's fine. + -> You can also write a new one from scratch, inheriting some other procedure using + the depend_procedure call and just overriding what you need. + + -> Commandline arguments are parsed by aif.sh but you can extend/override it's + behaviour by overriding $var_OPTS_STRING and the process_vars variable. + Also, you do not _have_ to use the variables they set (eg arg_ui_type). You + usually will set defaults in the configure worker and override with + arguments passed by the user (eg to use cli mode unless user wants dia) + +*** Libraries ** + -> If you have logic that may be reusable by several procedures, consider + putting the functions in a library so you, and others can easily use it. + +*** Profiles *** + -> You can take a profile and modify it + -> you can also use the depend_profile call and just override what you need. Note that if you load a module and a library has the same function names as @@ -142,36 +193,19 @@ You can specify a core procedure on the command line by specifying '<procedure_name>', to specify a user contriubuted procedure, specify '<module_name>/<procedure_name>' -Commandline arguments are parsed by aif.sh but you can extend/override it's -behaviour by overriding $var_OPTS_STRING and the process_vars variable. -Also, you do not _have_ to use the variables they set (eg arg_ui_type). You -usually will set defaults in the configure worker and override with -arguments passed by the user (eg to use cli mode unless user wants dia) ** Contributing ** + Install a VM (I use virtualbox-ose, works fine), make a vm, boot the install cd and just follow the HOWTO. It's probably easiest if you set up your own git clone that you can easily acces from the VM (You can open a github account and fork my code). -You can edit on the cd itself, but given the low resolution of the VM and the limited -choice of editors, you'll probably edit on your pc, commit, push to github +You can edit on the cd itself, but given the low resolution of the VM, you'll probably edit on your pc, commit, push to github and pull from the clone on the cd. If you want to do debugging, just call the debug function and export DEBUG=1 before calling the scripts. (or pass -d) Keep in mind there are 3 kinds of variables. Those that affect/belong to the runtime (install cd live environment), target (affects/belongs to the target installation) and TMP (everything in between or extra). Variablenames -should have _TARGET or _TMP suffixes or none for runtime. (Honestly though, -it isn't always the case like that now, I need to do more refactoring) -Bugs can be reported at http://bugs.archlinux.org/, project "Release Engineering" - -Much of the code in the core module is taken (and modified) from the 'real' arch linux install -scripts code. (/arch/setup and /arch/quickinst). the modifications are mostly done -to make the code more (re)useable, to separate backend code, user -interface and flow control (into libraries and procedures) (which was tightly coupled in the original scripts) -and to provide additional features. - -I couldn't find what license the code is under, but I assume this -is okay.. if not let me know. -The original code is at -http://projects.archlinux.org/?p=installer.git;a=summary +should have _TARGET or _TMP suffixes or none for runtime. (That's the +theory, it isn't always the case like that now, I need to do more refactoring) @@ -1,6 +1,12 @@ See also the FIXME's and TODO's in the code, and http://bugs.archlinux.org/toplevel/proj6 CURRENT ISSUES: +* implement depend_profile +* add /var/lib/aif/profiles directory to packages and document it. +* check the existence of /src/core/pkg and based on that set a different default value. in interactive_select_source +* > It displays the current time in UTC (if utc selected) not the users localtime (UTC +- TIMEZONE) +* interactive_autoprepare: merge _getavaildisks( and finddisks calls +* no uuid in fstab unlike previous thing * consider syslog as logging backend * add support for TARGET_PACKAGES_EXCLUDE to filter out packages from a group * more vars for automatic profile: hostname (check that adding to /etc/hosts can be done procedure-independently), diff --git a/examples/generic-install-on-sda b/examples/generic-install-on-sda index 9d25776..9934e22 100644 --- a/examples/generic-install-on-sda +++ b/examples/generic-install-on-sda @@ -1,4 +1,6 @@ -# these variables are optional, here are the defaults (feel free to omit them) +# this config explains the (all) available options. +# the variables are optional and we define their defaults here (so you could omit the +# definitions), unless otherwise specified. SOURCE=cd FILE_URL=file:///src/core/pkg @@ -9,8 +11,9 @@ RUNTIME_REPOSITORIES= RUNTIME_PACKAGES= # packages to install -TARGET_GROUPS=base #all packages in this group will be installed (defaults to base if no group and no packages are specified) -TARGET_PACKAGES=openssh # you can also specify separate packages (this is empty by default) +TARGET_GROUPS=base # all packages in this group will be installed (defaults to base if no group and no packages are specified) +TARGET_PACKAGES_EXCLUDE= # Exclude these packages if they are member of one of the groups in TARGET_GROUPS. example: 'nano reiserfsprogs' (they are in base) +TARGET_PACKAGES=openssh # you can also specify separate packages to install (this is empty by default) # you can optionally also override some functions... worker_intro () { @@ -33,7 +33,7 @@ process_args () echo "Welcome to $TITLE" mount -o remount,rw / &>/dev/null - +cleanup_runtime ### Set configuration values ### # note : you're free to use or ignore these in your procedure. probably you want to use these variables to override defaults in your configure worker diff --git a/src/core/libs/lib-flowcontrol.sh b/src/core/libs/lib-flowcontrol.sh index 8106310..14bbea4 100755 --- a/src/core/libs/lib-flowcontrol.sh +++ b/src/core/libs/lib-flowcontrol.sh @@ -4,8 +4,8 @@ usage () { msg="aif -p <procedurename> Select a procedure # If given, this *must* be the first option -i <dia/cli> Override interface type (optional) - -d Explicitly enable debugging (optional) - -l Explicitly enable logging to file (optional) + -d Explicitly enable debugging (/var/log/aif/debug.log) (optional) + -l Explicitly enable logging to file (/var/log/aif/aif.log) (optional) -h Help: show usage (optional)\n If the procedurename starts with 'http://' it will be wget'ed. Otherwise it's assumed to be a procedure in the VFS tree If the procedurename is prefixed with '<modulename>/' it will be loaded from user module <modulename>.\n @@ -56,7 +56,7 @@ load_procedure() { [ -z "$1" ] && die_error "load_procedure needs a module as \$1 and procedure as \$2" [ -z "$2" ] && die_error "load_procedure needs a procedure as \$2" - if [ "$1" = 'http:' ] + if [ "$1" = 'http' ] then log "Loading procedure $2 ..." procedure=$RUNTIME_DIR/aif-procedure-downloaded-`basename $2` @@ -202,7 +202,6 @@ show_report () #TODO: abstract UI method (cli/dia) start_installer () { log "################## START OF INSTALLATION ##################" - cleanup_runtime } diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh index 384cab4..c378577 100644 --- a/src/core/libs/lib-software.sh +++ b/src/core/libs/lib-software.sh @@ -22,8 +22,21 @@ run_mkinitcpio() # installpkg(). taken from setup. modified bigtime # performs package installation to the target system installpkg() { - ALL_PACKAGES=$var_TARGET_PACKAGES - [ -n "$TARGET_GROUPS" ] && ALL_PACKAGES="$ALL_PACKAGES "`list_packages group "$TARGET_GROUPS" | awk '{print $2}'` + ALL_PACKAGES= + [ -n "$var_TARGET_GROUPS" ] && ALL_PACKAGES=`list_packages group "$var_TARGET_GROUPS" | awk '{print $2}'` + if [ -n "$var_TARGET_PACKAGES_EXCLUDE" ] + then + for excl in $var_TARGET_PACKAGES_EXCLUDE + do + ALL_PACKAGES=${ALL_PACKAGES//$excl/} + done + fi + + if [ -n "$var_TARGET_PACKAGES" ] + then + [ -n "$ALL_PACKAGES" ] && ALL_PACKAGES="$ALL_PACKAGES $var_TARGET_PACKAGES" + [ -z "$ALL_PACKAGES" ] && ALL_PACKAGES=$var_TARGET_PACKAGES + fi ALL_PACKAGES=`echo $ALL_PACKAGES` [ -z "$ALL_PACKAGES" ] && die_error "No packages/groups specified to install" diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index ca885c0..812753e 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -22,6 +22,24 @@ interactive_configure_system() [ "$EDITOR" ] || interactive_get_editor FILE="" + ## PREPROCESSING ## + + #TODO: only need to do this once. check 'ended_ok worker configure_system' is not good because this could be done already even if worker did not exit 0 + # /etc/pacman.d/mirrorlist + # add installer-selected mirror to the top of the mirrorlist + if [ "$var_PKG_SOURCE_TYPE" = "ftp" -a "${var_SYNC_URL}" != "" ]; then + debug 'PROCEDURE' "Adding choosen mirror (${var_SYNC_URL}) to ${var_TARGET_DIR}/$var_MIRRORLIST" + mirrorlist=`awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${var_SYNC_URL}"\n\n\") } 1 " "${var_TARGET_DIR}/$var_MIRRORLIST"` + echo "$mirrorlist" > "${var_TARGET_DIR}/$var_MIRRORLIST" #TODO: test this, this may not work + fi + + # /etc/rc.conf + # Make sure timezone and utc info are what we want + # NOTE: If a timezone string never contains more then 1 slash, we can use ${TIMEZONE/\//\\/} + sed -i -e "s/^TIMEZONE=.*/TIMEZONE=\"${TIMEZONE//\//\\/}\"/g" \ + -e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$HARDWARECLOCK\"/g" \ + ${var_TARGET_DIR}/etc/rc.conf + # main menu loop while true; do DEFAULT=no @@ -129,6 +147,62 @@ interactive_time () { } +interactive_prepare_disks () +{ + DONE=0 + 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" + + #TODO: inform user (using dialog's --item-help or so) that autoprepare uses 1 disk and uses it in a "fairly regular" (though somewhat customizable) manner. + ask_option $default "Prepare Hard Drive" '' required \ + "1" "Auto-Prepare (erases the ENTIRE hard drive and sets up partitions and filesystems)" \ + "2" "Partition Hard Drives" \ + "3" "Configure block devices, filesystems and mountpoints" \ + "4" "Rollback last filesystem changes$rollbackstr" \ + "5" "Return to Main Menu" + + 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 && break; + interactive_autoprepare && NEXTITEM=5 && ret=0 && DISK_CONFIG_TYPE=auto;; #TODO: for some reason. if this completes $?=0, next item will be 1 :/ + "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 && break; + interactive_partition && ret=1 && NEXTITEM=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 && break; + PARTFINISH="" + interactive_filesystems && ret=0 && NEXTITEM=5 && DISK_CONFIG_TYPE=manual + ;; + "4") + if [ "$BLOCK_ROLLBACK_USELESS" = "1" ] + then + ask_yesno "It seems like you haven't partitioned/formatted/mounted anything yet (or rolled back already). This operation is useless (unless the installer is buggy), but it doesn't harm. Do you want to continue?" || NEXTITEM=5 + fi + if [ $? -eq 0 -o "$BLOCK_ROLLBACK_USELESS" = "0" ] + then + if rollback_filesystems #TODO: this part doesn't belong here. move it to ui-interactive. (interactive_rollback) + then + infofy "Rollback succeeded" + else + show_warning "Rollback failed" "Rollback failed" + fi + fi + ;; + *) + DONE=1 ;; + esac + done + return $ret +} @@ -731,6 +805,15 @@ interactive_runtime_network() { return 0 } +interactive_install_bootloader () { + ask_option Grub "Choose bootloader" "Which bootloader would you like to use? Grub is the Arch default." required \ + "Grub" "Use the GRUB bootloader (default)" \ + "None" "\Zb\Z1Warning\Z0\ZB: you must install your own bootloader!" + + bl=`tr '[:upper:]' '[:lower:]' <<< "$ANSWER_OPTION"` + [ "$bl" != grub ] && return 0 + interactive_install_grub +} interactive_install_grub() { get_grub_map @@ -940,3 +1023,17 @@ interactive_get_editor() { *) EDITOR="nano" ;; esac } + + +select_source_extras_menu () +{ + while true; do + ask_option no "FTP Installation" "Make sure the network is ok and you've selected a mirror before continuing the installer" required \ + "1" "$worker_runtime_network_title" \ + "2" "$worker_select_mirror_title" \ + "3" "Return to Main Menu" + [ "$ANSWER_OPTION" = 1 ] && execute worker runtime_network + [ "$ANSWER_OPTION" = 2 ] && execute worker select_mirror + [ "$ANSWER_OPTION" = 3 ] && break + done +} diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index b0e327a..58911ff 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -99,6 +99,7 @@ worker_package_list () { var_TARGET_PACKAGES=$TARGET_PACKAGES var_TARGET_GROUPS=$TARGET_GROUPS + var_TARGET_PACKAGES_EXCLUDE=$TARGET_PACKAGES_EXCLUDE [ -z "$var_TARGET_PACKAGES" -a -z "$var_TARGET_GROUPS" ] && var_TARGET_GROUPS=base } diff --git a/src/core/procedures/base b/src/core/procedures/base index e3ff45c..7d56b09 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -73,6 +73,12 @@ worker_select_source () } +worker_select_source_extras_menu () +{ + select_source_extras_menu +} + + 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 diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 86e3d63..3cd535e 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -64,7 +64,7 @@ mainmenu() "8" "Exit Install" case $ANSWER_OPTION in "1") - execute worker select_source; ret=$?; [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = ftp ] && select_source_extras_menu + execute worker select_source; ret=$?; [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = ftp ] && execute worker select_source_extras_menu [ $ret -eq 0 ] && execute worker runtime_packages && NEXTITEM=2 ;; "2") @@ -79,11 +79,13 @@ mainmenu() check_depend worker select_source && execute worker install_packages && { execute worker auto_fstab ; \ ended_ok worker runtime_network && execute worker auto_network ; \ execute worker auto_locale ; \ - execute worker auto_keymap_font; } && NEXTITEM=6 ;; + execute worker auto_keymap_font; + true ; } && NEXTITEM=6 ;; "6") check_depend worker install_packages && execute worker configure_system && { execute worker mkinitcpio ; \ execute worker locales ; - execute worker initialtime ; } && NEXTITEM=7 ;; #TODO: why is next item 4 if $?=0?. maybe fixed now + execute worker initialtime ; + true ; } && NEXTITEM=7 ;; "7") check_depend worker configure_system && execute worker install_bootloader && NEXTITEM=8 ;; "8") @@ -94,101 +96,15 @@ mainmenu() } -select_source_extras_menu () -{ - while true; do - ask_option no "FTP Installation" 'Make sure the network is ok before continuing the installer' required \ #TODO: display the "make sure network is okay" in a better way - "1" "$worker_runtime_network_title" \ - "2" "$worker_select_mirror_title" \ - "3" "Return to Main Menu" - [ "$ANSWER_OPTION" = 1 ] && execute worker runtime_network - [ "$ANSWER_OPTION" = 2 ] && execute worker select_mirror - [ "$ANSWER_OPTION" = 3 ] && break - done -} - worker_configure_system() { - ## PREPROCESSING ## - - #TODO: only need to do this once. check 'ended_ok worker configure_system' is not good because this could be done already even if worker did not exit 0 - # /etc/pacman.d/mirrorlist - # add installer-selected mirror to the top of the mirrorlist - if [ "$var_PKG_SOURCE_TYPE" = "ftp" -a "${var_SYNC_URL}" != "" ]; then - debug 'PROCEDURE' "Adding choosen mirror (${var_SYNC_URL}) to ${var_TARGET_DIR}/$var_MIRRORLIST" - mirrorlist=`awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${var_SYNC_URL}"\n\n\") } 1 " "${var_TARGET_DIR}/$var_MIRRORLIST"` - echo "$mirrorlist" > "${var_TARGET_DIR}/$var_MIRRORLIST" #TODO: test this, this may not work - fi - - # /etc/rc.conf - # Make sure timezone and utc info are what we want - # NOTE: If a timezone string never contains more then 1 slash, we can use ${TIMEZONE/\//\\/} - sed -i -e "s/^TIMEZONE=.*/TIMEZONE=\"${TIMEZONE//\//\\/}\"/g" \ - -e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$HARDWARECLOCK\"/g" \ - ${var_TARGET_DIR}/etc/rc.conf - - - interactive_configure_system && return 0 - return 1 + interactive_configure_system } worker_prepare_disks() { - DONE=0 - 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" - - #TODO: inform user (using dialog's --item-help or so) that autoprepare uses 1 disk and uses it in a "fairly regular" (though somewhat customizable) manner. - ask_option $default "Prepare Hard Drive" '' required \ - "1" "Auto-Prepare (erases the ENTIRE hard drive and sets up partitions and filesystems)" \ - "2" "Partition Hard Drives" \ - "3" "Configure block devices, filesystems and mountpoints" \ - "4" "Rollback last filesystem changes$rollbackstr" \ - "5" "Return to Main Menu" - - 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 && break; - interactive_autoprepare && NEXTITEM=5 && ret=0 && DISK_CONFIG_TYPE=auto;; #TODO: for some reason. if this completes $?=0, next item will be 1 :/ - "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 && break; - interactive_partition && ret=1 && NEXTITEM=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 && break; - PARTFINISH="" - interactive_filesystems && ret=0 && NEXTITEM=5 && DISK_CONFIG_TYPE=manual - ;; - "4") - if [ "$BLOCK_ROLLBACK_USELESS" = "1" ] - then - ask_yesno "It seems like you haven't partitioned/formatted/mounted anything yet (or rolled back already). This operation is useless (unless the installer is buggy), but it doesn't harm. Do you want to continue?" || NEXTITEM=5 - fi - if [ $? -eq 0 -o "$BLOCK_ROLLBACK_USELESS" = "0" ] - then - if rollback_filesystems #TODO: this part doesn't belong here. move it to ui-interactive. (interactive_rollback) - then - infofy "Rollback succeeded" - else - show_warning "Rollback failed" "Rollback failed" - fi - fi - ;; - *) - DONE=1 ;; - esac - done - return $ret + interactive_prepare_disks } @@ -248,13 +164,7 @@ worker_select_mirror () worker_install_bootloader () { - ask_option Grub "Choose bootloader" "Which bootloader would you like to use? Grub is the Arch default." required \ - "Grub" "Use the GRUB bootloader (default)" \ - "None" "\Zb\Z1Warning\Z0\ZB: you must install your own bootloader!" - - bl=`tr '[:upper:]' '[:lower:]' <<< "$ANSWER_OPTION"` - [ "$bl" != grub ] && return 0 - interactive_install_grub + interactive_install_bootloader } diff --git a/testplan b/testplan new file mode 100644 index 0000000..b941a1a --- /dev/null +++ b/testplan @@ -0,0 +1,19 @@ +for new 2.6.30 release: + +waitingfor: +- process following bug + +-- install -- +pick ftp +set network manually: http://bugs.archlinux.org/task/13237 +@select packages: +notice with listing of core repo + +@ configure system: +* check for notice +* make some changes in pacman.conf +* test canceling/done/exit codes + +---after reboot -- +check if mirrorlist is good +check pacman.conf |