36 |
#include <signal.h> |
#include <signal.h> |
37 |
#include <blkid/blkid.h> |
#include <blkid/blkid.h> |
38 |
|
|
39 |
|
#ifndef DEBUG |
40 |
#define DEBUG 0 |
#define DEBUG 0 |
41 |
|
#endif |
42 |
|
|
43 |
#if DEBUG |
#if DEBUG |
44 |
#define dbgPrintf(format, args...) fprintf(stderr, format , ## args) |
#define dbgPrintf(format, args...) fprintf(stderr, format , ## args) |
117 |
struct keywordTypes * keywords; |
struct keywordTypes * keywords; |
118 |
int defaultIsIndex; |
int defaultIsIndex; |
119 |
int defaultSupportSaved; |
int defaultSupportSaved; |
120 |
enum lineType_e entrySeparator; |
enum lineType_e entryStart; |
121 |
int needsBootPrefix; |
int needsBootPrefix; |
122 |
int argsInQuotes; |
int argsInQuotes; |
123 |
int maxTitleLength; |
int maxTitleLength; |
145 |
.keywords = grubKeywords, |
.keywords = grubKeywords, |
146 |
.defaultIsIndex = 1, |
.defaultIsIndex = 1, |
147 |
.defaultSupportSaved = 1, |
.defaultSupportSaved = 1, |
148 |
.entrySeparator = LT_TITLE, |
.entryStart = LT_TITLE, |
149 |
.needsBootPrefix = 1, |
.needsBootPrefix = 1, |
150 |
.mbHyperFirst = 1, |
.mbHyperFirst = 1, |
151 |
.mbInitRdIsModule = 1, |
.mbInitRdIsModule = 1, |
249 |
struct configFileInfo eliloConfigType = { |
struct configFileInfo eliloConfigType = { |
250 |
.defaultConfig = "/boot/efi/EFI/redhat/elilo.conf", |
.defaultConfig = "/boot/efi/EFI/redhat/elilo.conf", |
251 |
.keywords = eliloKeywords, |
.keywords = eliloKeywords, |
252 |
.entrySeparator = LT_KERNEL, |
.entryStart = LT_KERNEL, |
253 |
.needsBootPrefix = 1, |
.needsBootPrefix = 1, |
254 |
.argsInQuotes = 1, |
.argsInQuotes = 1, |
255 |
.mbConcatArgs = 1, |
.mbConcatArgs = 1, |
258 |
struct configFileInfo liloConfigType = { |
struct configFileInfo liloConfigType = { |
259 |
.defaultConfig = "/etc/lilo.conf", |
.defaultConfig = "/etc/lilo.conf", |
260 |
.keywords = liloKeywords, |
.keywords = liloKeywords, |
261 |
.entrySeparator = LT_KERNEL, |
.entryStart = LT_KERNEL, |
262 |
.argsInQuotes = 1, |
.argsInQuotes = 1, |
263 |
.maxTitleLength = 15, |
.maxTitleLength = 15, |
264 |
}; |
}; |
266 |
struct configFileInfo yabootConfigType = { |
struct configFileInfo yabootConfigType = { |
267 |
.defaultConfig = "/etc/yaboot.conf", |
.defaultConfig = "/etc/yaboot.conf", |
268 |
.keywords = yabootKeywords, |
.keywords = yabootKeywords, |
269 |
.entrySeparator = LT_KERNEL, |
.entryStart = LT_KERNEL, |
270 |
.needsBootPrefix = 1, |
.needsBootPrefix = 1, |
271 |
.argsInQuotes = 1, |
.argsInQuotes = 1, |
272 |
.maxTitleLength = 15, |
.maxTitleLength = 15, |
276 |
struct configFileInfo siloConfigType = { |
struct configFileInfo siloConfigType = { |
277 |
.defaultConfig = "/etc/silo.conf", |
.defaultConfig = "/etc/silo.conf", |
278 |
.keywords = siloKeywords, |
.keywords = siloKeywords, |
279 |
.entrySeparator = LT_KERNEL, |
.entryStart = LT_KERNEL, |
280 |
.needsBootPrefix = 1, |
.needsBootPrefix = 1, |
281 |
.argsInQuotes = 1, |
.argsInQuotes = 1, |
282 |
.maxTitleLength = 15, |
.maxTitleLength = 15, |
285 |
struct configFileInfo ziplConfigType = { |
struct configFileInfo ziplConfigType = { |
286 |
.defaultConfig = "/etc/zipl.conf", |
.defaultConfig = "/etc/zipl.conf", |
287 |
.keywords = ziplKeywords, |
.keywords = ziplKeywords, |
288 |
.entrySeparator = LT_TITLE, |
.entryStart = LT_TITLE, |
289 |
.argsInQuotes = 1, |
.argsInQuotes = 1, |
290 |
.titleBracketed = 1, |
.titleBracketed = 1, |
291 |
}; |
}; |
293 |
struct configFileInfo extlinuxConfigType = { |
struct configFileInfo extlinuxConfigType = { |
294 |
.defaultConfig = "/boot/extlinux/extlinux.conf", |
.defaultConfig = "/boot/extlinux/extlinux.conf", |
295 |
.keywords = extlinuxKeywords, |
.keywords = extlinuxKeywords, |
296 |
.entrySeparator = LT_TITLE, |
.entryStart = LT_TITLE, |
297 |
.needsBootPrefix = 1, |
.needsBootPrefix = 1, |
298 |
.maxTitleLength = 255, |
.maxTitleLength = 255, |
299 |
.mbAllowExtraInitRds = 1, |
.mbAllowExtraInitRds = 1, |
439 |
return 0; |
return 0; |
440 |
} |
} |
441 |
|
|
442 |
static int isEntrySeparator(struct singleLine * line, |
static int isEntryStart(struct singleLine * line, |
443 |
struct configFileInfo * cfi) { |
struct configFileInfo * cfi) { |
444 |
return line->type == cfi->entrySeparator || line->type == LT_OTHER || |
return line->type == cfi->entryStart || line->type == LT_OTHER || |
445 |
(cfi->titleBracketed && isBracketedTitle(line)); |
(cfi->titleBracketed && isBracketedTitle(line)); |
446 |
} |
} |
447 |
|
|
764 |
cfg->secondaryIndent = strdup(line->indent); |
cfg->secondaryIndent = strdup(line->indent); |
765 |
} |
} |
766 |
|
|
767 |
if (isEntrySeparator(line, cfi)) { |
if (isEntryStart(line, cfi)) { |
768 |
sawEntry = 1; |
sawEntry = 1; |
769 |
if (!entry) { |
if (!entry) { |
770 |
cfg->entries = malloc(sizeof(*entry)); |
cfg->entries = malloc(sizeof(*entry)); |
2675 |
/* don't have a template, so start the entry with the |
/* don't have a template, so start the entry with the |
2676 |
* appropriate starting line |
* appropriate starting line |
2677 |
*/ |
*/ |
2678 |
switch (config->cfi->entrySeparator) { |
switch (config->cfi->entryStart) { |
2679 |
case LT_KERNEL: |
case LT_KERNEL: |
2680 |
if (new->multiboot && config->cfi->mbHyperFirst) { |
if (new->multiboot && config->cfi->mbHyperFirst) { |
2681 |
/* fall through to LT_HYPER */ |
/* fall through to LT_HYPER */ |
2727 |
|
|
2728 |
/* add the remainder of the lines, i.e. those that either |
/* add the remainder of the lines, i.e. those that either |
2729 |
* 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, |
2730 |
* all the lines following the entrySeparator. |
* all the lines following the entryStart. |
2731 |
*/ |
*/ |
2732 |
if (needs & NEED_TITLE) { |
if (needs & NEED_TITLE) { |
2733 |
newLine = addLine(new, config->cfi, LT_TITLE, |
newLine = addLine(new, config->cfi, LT_TITLE, |