156 |
{ NULL, 0, 0 }, |
{ NULL, 0, 0 }, |
157 |
}; |
}; |
158 |
|
|
159 |
|
const char *grubFindConfig(struct configFileInfo *cfi) { |
160 |
|
static const char *configFiles[] = { |
161 |
|
"/etc/grub.conf", |
162 |
|
"/boot/grub/grub.conf", |
163 |
|
"/boot/grub/menu.lst", |
164 |
|
NULL |
165 |
|
}; |
166 |
|
static int i = -1; |
167 |
|
|
168 |
|
if (i == -1) { |
169 |
|
for (i = 0; configFiles[i] != NULL; i++) { |
170 |
|
dbgPrintf("Checking \"%s\": ", configFiles[i]); |
171 |
|
if (!access(configFiles[i], R_OK)) { |
172 |
|
dbgPrintf("found\n"); |
173 |
|
return configFiles[i]; |
174 |
|
} |
175 |
|
dbgPrintf("not found\n"); |
176 |
|
} |
177 |
|
} |
178 |
|
return configFiles[i]; |
179 |
|
} |
180 |
|
|
181 |
struct configFileInfo grubConfigType = { |
struct configFileInfo grubConfigType = { |
182 |
.defaultConfig = "/boot/grub/grub.conf", |
.findConfig = grubFindConfig, |
183 |
.keywords = grubKeywords, |
.keywords = grubKeywords, |
184 |
.defaultIsIndex = 1, |
.defaultIsIndex = 1, |
185 |
.defaultSupportSaved = 1, |
.defaultSupportSaved = 1, |
3412 |
gr2c = checkForGrub2(gconfig); |
gr2c = checkForGrub2(gconfig); |
3413 |
} |
} |
3414 |
|
|
3415 |
if (!access(grubConfigType.defaultConfig, F_OK)) { |
const char *grubconfig = grubFindConfig(&grubConfigType); |
3416 |
gconfig = readConfig(grubConfigType.defaultConfig, &grubConfigType); |
if (!access(grubconfig, F_OK)) { |
3417 |
|
gconfig = readConfig(grubconfig, &grubConfigType); |
3418 |
if (!gconfig) |
if (!gconfig) |
3419 |
grc = 1; |
grc = 1; |
3420 |
else |
else |