--- trunk/grubby/grubby.c 2012/02/18 00:32:14 1714 +++ trunk/grubby/grubby.c 2012/02/18 00:35:46 1715 @@ -156,8 +156,30 @@ { NULL, 0, 0 }, }; +const char *grubFindConfig(struct configFileInfo *cfi) { + static const char *configFiles[] = { + "/etc/grub.conf", + "/boot/grub/grub.conf", + "/boot/grub/menu.lst", + NULL + }; + static int i = -1; + + if (i == -1) { + for (i = 0; configFiles[i] != NULL; i++) { + dbgPrintf("Checking \"%s\": ", configFiles[i]); + if (!access(configFiles[i], R_OK)) { + dbgPrintf("found\n"); + return configFiles[i]; + } + dbgPrintf("not found\n"); + } + } + return configFiles[i]; +} + struct configFileInfo grubConfigType = { - .defaultConfig = "/boot/grub/grub.conf", + .findConfig = grubFindConfig, .keywords = grubKeywords, .defaultIsIndex = 1, .defaultSupportSaved = 1, @@ -3390,8 +3412,9 @@ gr2c = checkForGrub2(gconfig); } - if (!access(grubConfigType.defaultConfig, F_OK)) { - gconfig = readConfig(grubConfigType.defaultConfig, &grubConfigType); + const char *grubconfig = grubFindConfig(&grubConfigType); + if (!access(grubconfig, F_OK)) { + gconfig = readConfig(grubconfig, &grubConfigType); if (!gconfig) grc = 1; else