Magellan Linux

Diff of /tags/grubby-8_32/grubby.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1714 by niro, Sat Feb 18 00:32:14 2012 UTC revision 1715 by niro, Sat Feb 18 00:35:46 2012 UTC
# Line 156  struct keywordTypes grubKeywords[] = { Line 156  struct keywordTypes grubKeywords[] = {
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,
# Line 3390  int main(int argc, const char ** argv) { Line 3412  int main(int argc, const char ** argv) {
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

Legend:
Removed from v.1714  
changed lines
  Added in v.1715