2009-10-25  Vladimir Serbinenko  <phcoder@gmail.com>
2009-10-25  Colin Watson  <cjwatson@ubuntu.com>

	* normal/menu.c (grub_menu_execute_entry): Save selected entry title
	in `chosen' environment variable.
	* normal/menu_text.c (get_entry_number): Check if the variable
	matches the title of a menu entry.
	(run_menu): Pass menu to get_entry_number.

	* util/grub-reboot.in: New file.
	* util/grub-set-default.in: New file.
	* conf/common.rmk (grub-reboot): New utility.
	(grub-set-default): New utility.

	* util/grub-mkconfig_lib.in (save_default_entry): New function.
	* util/grub.d/00_header.in: If GRUB_DEFAULT is `saved', set
	default to `${saved_entry}'.  If `${prev_saved_entry}' is non-empty,
	move it to `saved_entry' for the next boot.  Load environment on
	initialisation.
	* util/grub.d/10_kfreebsd.in: Call save_default_entry.
	* util/grub.d/10_hurd.in: Likewise.
	* util/grub.d/10_linux.in (linux_entry): Likewise.
	* util/grub.d/10_windows.in: Likewise.
	* util/grub.d/30_os-prober.in: Likewise.

	* util/grub-install.in: Create environment block.
	* util/i386/efi/grub-install.in: Likewise.
	* util/ieee1275/grub-install.in: Likewise.
	* util/sparc64/ieee1275/grub-install.in: Likewise.
