2494 |
entry->skip = 1; |
entry->skip = 1; |
2495 |
} |
} |
2496 |
|
|
2497 |
void setDefaultImage(struct grubConfig *config, int hasNew, |
void setDefaultImage(struct grubConfig *config, int isUserSpecifiedKernelPath, |
2498 |
const char *defaultKernelPath, int newIsDefault, |
const char *defaultKernelPath, int newBootEntryIsDefault, |
2499 |
const char *prefix, int flags, int index) |
const char *prefix, int flags, int newDefaultBootEntryIndex) |
2500 |
{ |
{ |
2501 |
struct singleEntry *entry, *entry2, *newDefault; |
struct singleEntry *entry, *entry2, *newDefault; |
2502 |
int i, j; |
int i, j; |
2503 |
|
|
2504 |
if (newIsDefault) { |
if (newBootEntryIsDefault) { |
2505 |
config->defaultImage = 0; |
config->defaultImage = 0; |
2506 |
return; |
return; |
2507 |
} else if ((index >= 0) && config->cfi->defaultIsIndex) { |
} else if ((newDefaultBootEntryIndex >= 0) && config->cfi->defaultIsIndex) { |
2508 |
if (findEntryByIndex(config, index)) |
if (findEntryByIndex(config, newDefaultBootEntryIndex)) |
2509 |
config->defaultImage = index; |
config->defaultImage = newDefaultBootEntryIndex; |
2510 |
else |
else |
2511 |
config->defaultImage = -1; |
config->defaultImage = -1; |
2512 |
return; |
return; |
2534 |
|
|
2535 |
if (entry && !entry->skip) { |
if (entry && !entry->skip) { |
2536 |
/* we can preserve the default */ |
/* we can preserve the default */ |
2537 |
if (hasNew) |
if (isUserSpecifiedKernelPath) |
2538 |
config->defaultImage++; |
config->defaultImage++; |
2539 |
|
|
2540 |
/* count the number of entries erased before this one */ |
/* count the number of entries erased before this one */ |
2543 |
if (entry2->skip) |
if (entry2->skip) |
2544 |
config->defaultImage--; |
config->defaultImage--; |
2545 |
} |
} |
2546 |
} else if (hasNew) { |
} else if (isUserSpecifiedKernelPath) { |
2547 |
config->defaultImage = 0; |
config->defaultImage = 0; |
2548 |
} else { |
} else { |
2549 |
/* Either we just erased the default (or the default line was |
/* Either we just erased the default (or the default line was |