--- trunk/grubby/grubby.c 2014/07/16 10:45:12 2692 +++ trunk/grubby/grubby.c 2014/07/16 11:01:36 2718 @@ -60,7 +60,7 @@ int isEfi = 0; -#if defined(__arch64__) +#if defined(__aarch64__) #define isEfiOnly 1 #else #define isEfiOnly 0 @@ -1199,7 +1199,7 @@ * lines came earlier in the template, make sure to use LT_HYPER * instead of LT_KERNEL now */ - if (entry->multiboot) + if (entry && entry->multiboot) line->type = LT_HYPER; } else if (line->type == LT_MBMODULE) { @@ -1960,11 +1960,13 @@ } indexVars[i + 1] = -1; - + i = 0; if (index) { - while (i < *index) i++; - if (indexVars[i] == -1) return NULL; + while (i < *index) { + i++; + if (indexVars[i] == -1) return NULL; + } } entry = findEntryByIndex(config, indexVars[i]); @@ -2276,6 +2278,7 @@ struct singleLine * line; char * root = NULL; int i; + int j; printf("index=%d\n", index); @@ -2367,6 +2370,20 @@ if (title) printf("title=%s\n", title); } + + for (j = 0, line = entry->lines; line; line = line->next) { + if ((line->type & LT_MBMODULE) && line->numElements >= 2) { + if (!strncmp(prefix, line->elements[1].item, strlen(prefix))) + printf("mbmodule%d=", j); + else + printf("mbmodule%d=%s", j, prefix); + + for (i = 1; i < line->numElements; i++) + printf("%s%s", line->elements[i].item, line->elements[i].indent); + printf("\n"); + j++; + } + } } int isSuseSystem(void) { @@ -4038,6 +4055,13 @@ } } + struct singleLine *endLine = NULL; + endLine = getLineByType(LT_ENTRY_END, new->lines); + if (endLine) { + removeLine(new, endLine); + needs |= NEED_END; + } + /* add the remainder of the lines, i.e. those that either * weren't present in the template, or in the case of no template, * all the lines following the entryStart. @@ -4096,6 +4120,7 @@ config->secondaryIndent, NULL); needs &= ~NEED_END; } + if (needs) { printf(_("grubby: needs=%d, aborting\n"), needs); abort();