Fix menu title instability bug.

* grub-core/commands/menuentry.c (options): New option --id.
	(grub_normal_add_menu_entry): New argument id. All users updated.
	(grub_cmd_menuentry): Handle --id.
	(grub_menu_init): Accept unknown arguments.
	* grub-core/normal/main.c (features): Add feature_menuentry_id and
	feature_menuentry_options.
	* grub-core/normal/menu.c (grub_menu_execute_entry): Use id for
	saved_entry.
	(get_entry_number): Match with id as well.
	* include/grub/menu.h (grub_menu_entry): New member id.
	* util/grub-mkconfig_lib.in (grub_get_device_id): New function.
	* util/grub.d/00_header.in: Define menuentry_id_option.
	* util/grub.d/10_hurd.in: Define id.
	* util/grub.d/10_illumos.in: Likewise.
	* util/grub.d/10_kfreebsd.in: Likewise.
	* util/grub.d/10_linux.in: Likewise.
	* util/grub.d/10_netbsd.in: Likewise.
	* util/grub.d/10_windows.in: Likewise.
	* util/grub.d/20_linux_xen.in: Likewise.
	* util/grub.d/30_os-prober.in: Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-03-04 14:55:13 +01:00
parent 0d31b7df86
commit d9bef9bc43
17 changed files with 126 additions and 27 deletions

View file

@ -63,14 +63,16 @@ for drv in $drives ; do
test -n "$dir" || continue
needmap=
osid=
# Check for Vista bootmgr.
if [ -f "$dir"/bootmgr -a -f "$dir"/boot/bcd ] ; then
OS="$(gettext_quoted "Windows Vista/7 (loader)")"
osid=bootmgr
# Check for NTLDR.
elif [ -f "$dir"/ntldr -a -f "$dir"/ntdetect.com -a -f "$dir"/boot.ini ] ; then
OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="$(gettext_quoted "Windows NT/2000/XP (loader)")"
osid=ntldr
needmap=t
else
@ -82,7 +84,7 @@ for drv in $drives ; do
gettext_printf "Found %s on %s (%s)\n" "$OS" "$drv" "$dev" >&2
cat << EOF
menuentry "$OS" {
menuentry "$OS" \$menuentry_id_option '$osid-$(grub_get_device_id "${dev}")' {
EOF
save_default_entry | sed -e 's,^,\t,'