Steffen Winterfeldt 2010-04-19 13:41:32 +00:00 committed by Git OBS Bridge
parent 4ef5c1082a
commit 1449bfaaea
2 changed files with 120 additions and 0 deletions

View File

@ -569,3 +569,118 @@ index 3460c18..c5112f4 100644
-- --
1.6.4.2 1.6.4.2
From bf3fd44448fb81ac481a2a1ac6d90f5a27e4d1de Mon Sep 17 00:00:00 2001
From: Steffen Winterfeldt <wfeldt@opensuse.org>
Date: Mon, 19 Apr 2010 15:17:57 +0200
Subject: [PATCH] fix menu label handling
Signed-off-by: Steffen Winterfeldt <wfeldt@opensuse.org>
---
com32/gfxboot/gfxboot.c | 48 +++++++++++++++++++++++++++-------------------
1 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c
index c5112f4..a6c95fe 100644
--- a/com32/gfxboot/gfxboot.c
+++ b/com32/gfxboot/gfxboot.c
@@ -116,14 +116,15 @@ typedef struct __attribute__ ((packed)) {
// menu description
typedef struct menu_s {
struct menu_s *next;
- char *label;
- char *kernel;
- char *alt_kernel;
- char *linux;
- char *localboot;
- char *initrd;
- char *append;
- char *ipappend;
+ char *label; // config entry name
+ char *menu_label; // text to show in boot menu
+ char *kernel; // name of program to load
+ char *alt_kernel; // alternative name in case user has replaced it
+ char *linux; // de facto an alias for 'kernel'
+ char *localboot; // boot from local disk
+ char *initrd; // initrd as separate line (instead of as part of 'append')
+ char *append; // kernel args
+ char *ipappend; // append special pxelinux args (see doc)
} menu_t;
@@ -345,7 +346,7 @@ int read_config_file(void)
menu_ptr = *menu_next = calloc(1, sizeof **menu_next);
menu_next = &menu_ptr->next;
menu_idx++;
- menu_ptr->label = strdup(t);
+ menu_ptr->label = menu_ptr->menu_label = strdup(t);
u = strlen(t);
if(u > label_size) label_size = u;
continue;
@@ -390,7 +391,7 @@ int read_config_file(void)
t = skip_spaces(t);
if(!strcasecmp(s, "label")) {
- menu_ptr->label = strdup(t);
+ menu_ptr->menu_label = strdup(t);
u = strlen(t);
if(u > label_size) label_size = u;
continue;
@@ -404,15 +405,22 @@ int read_config_file(void)
label_size++;
append_size++;
- gfx_menu.entries = menu_idx;
- gfx_menu.label_size = label_size;
- gfx_menu.arg_size = append_size;
+ // ensure we have a default entry
+ if(!menu_default->label) menu_default->label = menu->label;
- gfx_menu.default_entry = menu_default->label;
- if(!gfx_menu.default_entry && menu) {
- gfx_menu.default_entry = menu->label;
+ if(menu_default->label) {
+ for(menu_ptr = menu; menu_ptr; menu_ptr = menu_ptr->next) {
+ if(!strcmp(menu_default->label, menu_ptr->label)) {
+ menu_default->menu_label = menu_ptr->menu_label;
+ break;
+ }
+ }
}
+ gfx_menu.entries = menu_idx;
+ gfx_menu.label_size = label_size;
+ gfx_menu.arg_size = append_size;
+ gfx_menu.default_entry = menu_default->menu_label;
gfx_menu.label_list = calloc(menu_idx, label_size);
gfx_menu.arg_list = calloc(menu_idx, append_size);
@@ -420,7 +428,7 @@ int read_config_file(void)
if(!menu_ptr->append) menu_ptr->append = menu_default->append;
if(!menu_ptr->ipappend) menu_ptr->ipappend = menu_default->ipappend;
- if(menu_ptr->label) strcpy(gfx_menu.label_list + u * label_size, menu_ptr->label);
+ if(menu_ptr->menu_label) strcpy(gfx_menu.label_list + u * label_size, menu_ptr->menu_label);
if(menu_ptr->append) strcpy(gfx_menu.arg_list + u * append_size, menu_ptr->append);
}
@@ -789,13 +797,13 @@ void boot(int index)
}
// invalid index or menu entry
- if(!menu_ptr || !menu_ptr->label) return;
+ if(!menu_ptr || !menu_ptr->menu_label) return;
arg = skip_spaces(cmdline);
- label_len = strlen(menu_ptr->label);
+ label_len = strlen(menu_ptr->menu_label);
// if it does not start with label string, assume first word is kernel name
- if(strncmp(arg, menu_ptr->label, label_len)) {
+ if(strncmp(arg, menu_ptr->menu_label, label_len)) {
alt_kernel = arg;
arg = skip_nonspaces(arg);
if(*arg) *arg++ = 0;
--
1.6.4.2

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Apr 19 15:41:01 CEST 2010 - snwint@suse.de
- fix menu label handling
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Apr 16 13:23:24 CEST 2010 - snwint@suse.de Fri Apr 16 13:23:24 CEST 2010 - snwint@suse.de