On Sun, 20 Feb 2011 23:09:37 -0500
[email protected] wrote:

> ---
>  src/core/libs/lib-ui-interactive.sh |   30 +++++++++++++++++++++---------
>  1 files changed, 21 insertions(+), 9 deletions(-)
> 
> diff --git a/src/core/libs/lib-ui-interactive.sh 
> b/src/core/libs/lib-ui-interactive.sh
> index 16a9600..3cbbc00 100644
> --- a/src/core/libs/lib-ui-interactive.sh
> +++ b/src/core/libs/lib-ui-interactive.sh
> @@ -715,7 +715,7 @@ interactive_select_packages() {
>       target_prepare_pacman || { show_warning 'Pacman preparation failure' 
> "Pacman preparation failed! Check $LOG for errors."; return 1; }
>  
>       repos=`list_pacman_repos target`
> -     notify "Package selection is split into two stages.  First you will 
> select package groups that contain packages you may be interested in.  Then 
> you will be presented with a full list of packages for each group, allowing 
> you to fine-tune.\n\n
> +     notify "Package selection is split into three stages. First, you will 
> select a bootloader. Then, you will select package groups that contain 
> packages that you may be interested in. Lastly, you will be presented with a 
> full list of packages for each group, allowing you to fine-tune.\n\n
>  Note that right now the packages (and groups) selection is limited to the 
> repos available at this time ($repos).  Once you have your Arch system up and 
> running, you have access to more repositories and packages.\n\n
>  If any previous configuration you've done until now (like fancy filesystems) 
> require extra packages, we've already preselected them for your convenience"
>  
> @@ -725,6 +725,20 @@ If any previous configuration you've done until now 
> (like fancy filesystems) req
>               grouplist+=(${i} - OFF)
>       done
>  
> +     ask_option Grub "Choose bootloader" "Which bootloader would you like to 
> use?" required \
> +     "Grub" "Use the GRUB bootloader" \
> +     "Syslinux" "Use the Syslinux bootloader (ext2/3/4, btrfs, and vfat)" \
> +     "None" "\Zb\Z1Warning\Z0\ZB: you must install your own bootloader!" || 
> return 1
> +
> +     # Convert to lower case
> +     bootloader=${ANSWER_OPTION,,}

make the options lowercase in the first place.
like we discussed on IRC, it would be beneficial to:
* in lib-blockdevices-filesystems.sh put something like:
supported_bootloaders=(syslinux grub) # must be packagenames, first one will
be default
* leverage that array, also leverage syslinux_supported_fs for the menu


> +
> +     if [[ $bootloader = grub ]]; then
> +             local needed_pkg_bootloader=grub
> +     elif [[ $bootloader = syslinux ]]; then
> +             local needed_pkg_bootloader=syslinux
> +     fi
how about something like:
check_is_in $ANSWER_OPTION ('grub' 'syslinux') || return 1
local needed_pkg_bootloader=$ANSWER_OPTION

> +
>       ask_checklist "Select Package groups\nDo not deselect base unless you 
> know what you're doing!" 0 "${grouplist[@]}" || return 1
>       grouplist=("${ANSWER_CHECKLIST[@]}")
>  
> @@ -735,6 +749,7 @@ If any previous configuration you've done until now (like 
> fancy filesystems) req
>       # build the list of options, sorted primarily by group, then by 
> packagename (this is already). marking where appropriate
>       local pkglist=()
>       needed_pkgs=("${needed_pkgs_fs[@]}")
> +     needed_pkgs+=("$needed_pkg_bootloader")
>       while read pkgname pkgver pkggroup pkgdesc; do
>               mark=OFF
>               if check_is_in "$pkggroup" "${grouplist[@]}" || check_is_in 
> $pkgname "${needed_pkgs[@]}"; then
> @@ -843,18 +858,15 @@ interactive_runtime_network() {
>       return 0
>  }
>  
> +# bootloader is global variable that gets set in interactive_select_packages
>  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)" \
> -     "Syslinux" "Use the Syslinux bootloader (ext2/3/4, btrfs, and vfat)" \
> -     "None" "\Zb\Z1Warning\Z0\ZB: you must install your own bootloader!" || 
> return 1
> -
> -     bl=`tr '[:upper:]' '[:lower:]' <<< "$ANSWER_OPTION"`
> -     if [[ $bl == grub ]]; then
> +     if [[ $bootloader = grub ]]; then
>               GRUB_OK=0
>               interactive_grub
> -     elif [[ $bl == syslinux ]]; then
> +     elif [[ $bootloader = syslinux ]]; then
>               interactive_syslinux
> +     else
> +             show_warning 'No Bootloader' 'You did not select a bootloader. 
> No bootloader will be installed.' && return 1

"no bootloader" is an accepted solution -> return 0, not 1 ! otherwise the step 
will register as failed.


Reply via email to