60 |
|
|
61 |
int isEfi = 0; |
int isEfi = 0; |
62 |
|
|
63 |
#if defined(__arch64__) |
#if defined(__aarch64__) |
64 |
#define isEfiOnly 1 |
#define isEfiOnly 1 |
65 |
#else |
#else |
66 |
#define isEfiOnly 0 |
#define isEfiOnly 0 |
161 |
int defaultIsVariable; |
int defaultIsVariable; |
162 |
int defaultSupportSaved; |
int defaultSupportSaved; |
163 |
int defaultIsSaved; |
int defaultIsSaved; |
164 |
|
int defaultIsUnquoted; |
165 |
enum lineType_e entryStart; |
enum lineType_e entryStart; |
166 |
enum lineType_e entryEnd; |
enum lineType_e entryEnd; |
167 |
int needsBootPrefix; |
int needsBootPrefix; |
637 |
.needsBootPrefix = 1, |
.needsBootPrefix = 1, |
638 |
.maxTitleLength = 255, |
.maxTitleLength = 255, |
639 |
.mbAllowExtraInitRds = 1, |
.mbAllowExtraInitRds = 1, |
640 |
|
.defaultIsUnquoted = 1, |
641 |
}; |
}; |
642 |
|
|
643 |
struct grubConfig { |
struct grubConfig { |
1193 |
cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT; |
cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT; |
1194 |
defaultLine = line; |
defaultLine = line; |
1195 |
} |
} |
|
} else if (line->type == LT_DEFAULT && line->numElements == 2) { |
|
|
cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT; |
|
|
defaultLine = line; |
|
1196 |
|
|
1197 |
} else if (iskernel(line->type)) { |
} else if (iskernel(line->type)) { |
1198 |
/* if by some freak chance this is multiboot and the "module" |
/* if by some freak chance this is multiboot and the "module" |
1199 |
* lines came earlier in the template, make sure to use LT_HYPER |
* lines came earlier in the template, make sure to use LT_HYPER |
1200 |
* instead of LT_KERNEL now |
* instead of LT_KERNEL now |
1201 |
*/ |
*/ |
1202 |
if (entry->multiboot) |
if (entry && entry->multiboot) |
1203 |
line->type = LT_HYPER; |
line->type = LT_HYPER; |
1204 |
|
|
1205 |
} else if (line->type == LT_MBMODULE) { |
} else if (line->type == LT_MBMODULE) { |
1225 |
cfg->fallbackImage = strtol(line->elements[1].item, &end, 10); |
cfg->fallbackImage = strtol(line->elements[1].item, &end, 10); |
1226 |
if (*end) cfg->fallbackImage = -1; |
if (*end) cfg->fallbackImage = -1; |
1227 |
|
|
1228 |
} else if (line->type == LT_TITLE && line->numElements > 1) { |
} else if ((line->type == LT_DEFAULT && cfi->defaultIsUnquoted) || |
1229 |
/* make the title a single argument (undoing our parsing) */ |
(line->type == LT_TITLE && line->numElements > 1)) { |
1230 |
|
/* make the title/default a single argument (undoing our parsing) */ |
1231 |
len = 0; |
len = 0; |
1232 |
for (int i = 1; i < line->numElements; i++) { |
for (int i = 1; i < line->numElements; i++) { |
1233 |
len += strlen(line->elements[i].item); |
len += strlen(line->elements[i].item); |
1334 |
} |
} |
1335 |
} |
} |
1336 |
|
|
1337 |
|
if (line->type == LT_DEFAULT && line->numElements == 2) { |
1338 |
|
cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT; |
1339 |
|
defaultLine = line; |
1340 |
|
} |
1341 |
|
|
1342 |
/* If we find a generic config option which should live at the |
/* If we find a generic config option which should live at the |
1343 |
top of the file, move it there. Old versions of grubby were |
top of the file, move it there. Old versions of grubby were |
1344 |
probably responsible for putting new images in the wrong |
probably responsible for putting new images in the wrong |
2276 |
struct singleLine * line; |
struct singleLine * line; |
2277 |
char * root = NULL; |
char * root = NULL; |
2278 |
int i; |
int i; |
2279 |
|
int j; |
2280 |
|
|
2281 |
printf("index=%d\n", index); |
printf("index=%d\n", index); |
2282 |
|
|
2368 |
if (title) |
if (title) |
2369 |
printf("title=%s\n", title); |
printf("title=%s\n", title); |
2370 |
} |
} |
2371 |
|
|
2372 |
|
for (j = 0, line = entry->lines; line; line = line->next) { |
2373 |
|
if ((line->type & LT_MBMODULE) && line->numElements >= 2) { |
2374 |
|
if (!strncmp(prefix, line->elements[1].item, strlen(prefix))) |
2375 |
|
printf("mbmodule%d=", j); |
2376 |
|
else |
2377 |
|
printf("mbmodule%d=%s", j, prefix); |
2378 |
|
|
2379 |
|
for (i = 1; i < line->numElements; i++) |
2380 |
|
printf("%s%s", line->elements[i].item, line->elements[i].indent); |
2381 |
|
printf("\n"); |
2382 |
|
j++; |
2383 |
|
} |
2384 |
|
} |
2385 |
} |
} |
2386 |
|
|
2387 |
int isSuseSystem(void) { |
int isSuseSystem(void) { |
4053 |
} |
} |
4054 |
} |
} |
4055 |
|
|
4056 |
|
struct singleLine *endLine = NULL; |
4057 |
|
endLine = getLineByType(LT_ENTRY_END, new->lines); |
4058 |
|
if (endLine) { |
4059 |
|
removeLine(new, endLine); |
4060 |
|
needs |= NEED_END; |
4061 |
|
} |
4062 |
|
|
4063 |
/* add the remainder of the lines, i.e. those that either |
/* add the remainder of the lines, i.e. those that either |
4064 |
* weren't present in the template, or in the case of no template, |
* weren't present in the template, or in the case of no template, |
4065 |
* all the lines following the entryStart. |
* all the lines following the entryStart. |
4118 |
config->secondaryIndent, NULL); |
config->secondaryIndent, NULL); |
4119 |
needs &= ~NEED_END; |
needs &= ~NEED_END; |
4120 |
} |
} |
4121 |
|
|
4122 |
if (needs) { |
if (needs) { |
4123 |
printf(_("grubby: needs=%d, aborting\n"), needs); |
printf(_("grubby: needs=%d, aborting\n"), needs); |
4124 |
abort(); |
abort(); |