[arch-releng] [PATCH 2/3] Prompt user to pick a bootloader in interactive_select_packages and select the proper package for installation.
Dieter Plaetinck
dieter at plaetinck.be
Sun Feb 27 13:26:08 EST 2011
On Sun, 27 Feb 2011 11:55:17 -0500
pyther at pyther.net wrote:
> diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
> index 062c420..be31440 100644
> --- a/src/core/libs/lib-ui-interactive.sh
> +++ b/src/core/libs/lib-ui-interactive.sh
> @@ -2,7 +2,7 @@
> # A library which allows you to do backend stuff by using user interfaces
>
> # Global Variables
> -grubmenu="/boot/grub/menu.lst" # be sure to override this if you have it somewhere else
> +grubmenu="/boot/grub/menu.lst"
why do you remove the comment?
> +
> + bootloader=$ANSWER_OPTION
> +
> + # Make sure selected bootloader is a supported_bootloader and mark bootloader for installation
> + check_is_in $bootloader "${supported_bootloaders[@]}" && needed_pkgs+=("$bootloader")
> +
> ask_checklist "Select Package groups\nDo not deselect base unless you know what you're doing!" 0 "${grouplist[@]}" || return 1
> grouplist=("${ANSWER_CHECKLIST[@]}")
>
> @@ -731,9 +740,11 @@ If any previous configuration you've done until now (like fancy filesystems) req
> local pkgall=($(list_packages repo core | cut -d ' ' -f2))
> pkginfo "${pkgall[@]}"
>
> + # packages that should be marked for installation
> + needed_pkgs=("${needed_pkgs_fs[@]}")
> +
> # 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[@]}")
why did you rearrange this?
> while read pkgname pkgver pkggroup pkgdesc; do
> mark=OFF
> if check_is_in "$pkggroup" "${grouplist[@]}" || check_is_in $pkgname "${needed_pkgs[@]}"; then
> @@ -842,15 +853,14 @@ 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)" \
> - "None" "\Zb\Z1Warning\Z0\ZB: you must install your own bootloader!" || return 1
> -
> - bl=`tr '[:upper:]' '[:lower:]' <<< "$ANSWER_OPTION"`
> - [ "$bl" != grub ] && return 0
> - GRUB_OK=0
> - interactive_grub
> + if [[ $bootloader = grub ]]; then
> + GRUB_OK=0
> + interactive_grub
> + else
> + show_warning 'No Bootloader' 'You did not select a bootloader. No bootloader will be installed.' && return 0
> + fi
> }
I would make the exitcode a bit more obvious
put 'return 0' at the end of the function, remove it from the 'no bootloader' warning and write
interactive_grub || return 1
Dieter
More information about the arch-releng
mailing list