[arch-releng] [PATCH 2/3] Prompt user to pick a bootloader in interactive_select_packages and select the proper package for installation.

pyther at pyther.net pyther at pyther.net
Sun Feb 27 11:55:17 EST 2011


---
 src/core/libs/lib-blockdevices-filesystems.sh |    1 +
 src/core/libs/lib-ui-interactive.sh           |   32 ++++++++++++++++--------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index ac749a3..5bf181e 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -93,6 +93,7 @@ get_possible_fs () {
 	done
 }
 
+supported_bootloaders=('grub')
 
 # procedural code from quickinst functionized and fixed.
 # there were functions like this in the setup script too, with some subtle differences.  see below
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"
 
 # 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
@@ -709,12 +709,13 @@ device type label size type create? mountpoint options label params" required "$
 # params: none
 # returns: 1 on error
 interactive_select_packages() {
+	local needed_pkgs=()
 
 	# set up our install location if necessary and sync up so we can get package lists
 	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"
 
@@ -724,6 +725,14 @@ If any previous configuration you've done until now (like fancy filesystems) req
 		grouplist+=(${i} - OFF)
 	done
 
+	ask_option no "Choose bootloader" "Which bootloader would you like to use?" optional \
+	"grub" "GRUB bootloader"
+
+	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[@]}")
 	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
 }
 
 interactive_grub() {
-- 
1.7.4.1



More information about the arch-releng mailing list