Magellan Linux

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

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

trunk/mkinitrd-magellan/grubby/grubby.c revision 1304 by niro, Fri May 27 16:19:11 2011 UTC trunk/grubby/grubby.c revision 1693 by niro, Fri Feb 17 23:21:08 2012 UTC
# Line 115  struct configFileInfo { Line 115  struct configFileInfo {
115      struct keywordTypes * keywords;      struct keywordTypes * keywords;
116      int defaultIsIndex;      int defaultIsIndex;
117      int defaultSupportSaved;      int defaultSupportSaved;
118      enum lineType_e entrySeparator;      enum lineType_e entryStart;
119      int needsBootPrefix;      int needsBootPrefix;
120      int argsInQuotes;      int argsInQuotes;
121      int maxTitleLength;      int maxTitleLength;
# Line 139  struct keywordTypes grubKeywords[] = { Line 139  struct keywordTypes grubKeywords[] = {
139  };  };
140    
141  struct configFileInfo grubConfigType = {  struct configFileInfo grubConfigType = {
142      "/boot/grub/grub.conf",    /* defaultConfig */      .defaultConfig = "/boot/grub/grub.conf",
143      grubKeywords,    /* keywords */      .keywords = grubKeywords,
144      1,    /* defaultIsIndex */      .defaultIsIndex = 1,
145      1,    /* defaultSupportSaved */      .defaultSupportSaved = 1,
146      LT_TITLE,    /* entrySeparator */      .entryStart = LT_TITLE,
147      1,    /* needsBootPrefix */      .needsBootPrefix = 1,
148      0,    /* argsInQuotes */      .mbHyperFirst = 1,
149      0,    /* maxTitleLength */      .mbInitRdIsModule = 1,
150      0,                                      /* titleBracketed */      .mbAllowExtraInitRds = 1,
     1,                                      /* mbHyperFirst */  
     1,                                      /* mbInitRdIsModule */  
     0,                                      /* mbConcatArgs */  
     1,                                      /* mbAllowExtraInitRds */  
151  };  };
152    
153  struct keywordTypes yabootKeywords[] = {  struct keywordTypes yabootKeywords[] = {
# Line 249  struct keywordTypes extlinuxKeywords[] = Line 245  struct keywordTypes extlinuxKeywords[] =
245  };  };
246  int useextlinuxmenu;  int useextlinuxmenu;
247  struct configFileInfo eliloConfigType = {  struct configFileInfo eliloConfigType = {
248      "/boot/efi/EFI/redhat/elilo.conf",    /* defaultConfig */      .defaultConfig = "/boot/efi/EFI/redhat/elilo.conf",
249      eliloKeywords,    /* keywords */      .keywords = eliloKeywords,
250      0,    /* defaultIsIndex */      .entryStart = LT_KERNEL,
251      0,    /* defaultSupportSaved */      .needsBootPrefix = 1,
252      LT_KERNEL,    /* entrySeparator */      .argsInQuotes = 1,
253      1,                    /* needsBootPrefix */      .mbConcatArgs = 1,
     1,    /* argsInQuotes */  
     0,    /* maxTitleLength */  
     0,                                      /* titleBracketed */  
     0,                                      /* mbHyperFirst */  
     0,                                      /* mbInitRdIsModule */  
     1,                                      /* mbConcatArgs */  
     0,                                      /* mbAllowExtraInitRds */  
254  };  };
255    
256  struct configFileInfo liloConfigType = {  struct configFileInfo liloConfigType = {
257      "/etc/lilo.conf",    /* defaultConfig */      .defaultConfig = "/etc/lilo.conf",
258      liloKeywords,    /* keywords */      .keywords = liloKeywords,
259      0,    /* defaultIsIndex */      .entryStart = LT_KERNEL,
260      0,    /* defaultSupportSaved */      .argsInQuotes = 1,
261      LT_KERNEL,    /* entrySeparator */      .maxTitleLength = 15,
     0,    /* needsBootPrefix */  
     1,    /* argsInQuotes */  
     15,    /* maxTitleLength */  
     0,                                      /* titleBracketed */  
     0,                                      /* mbHyperFirst */  
     0,                                      /* mbInitRdIsModule */  
     0,                                      /* mbConcatArgs */  
     0,                                      /* mbAllowExtraInitRds */  
262  };  };
263    
264  struct configFileInfo yabootConfigType = {  struct configFileInfo yabootConfigType = {
265      "/etc/yaboot.conf",    /* defaultConfig */      .defaultConfig = "/etc/yaboot.conf",
266      yabootKeywords,    /* keywords */      .keywords = yabootKeywords,
267      0,    /* defaultIsIndex */      .entryStart = LT_KERNEL,
268      0,    /* defaultSupportSaved */      .needsBootPrefix = 1,
269      LT_KERNEL,    /* entrySeparator */      .argsInQuotes = 1,
270      1,    /* needsBootPrefix */      .maxTitleLength = 15,
271      1,    /* argsInQuotes */      .mbAllowExtraInitRds = 1,
     15,    /* maxTitleLength */  
     0,                                      /* titleBracketed */  
     0,                                      /* mbHyperFirst */  
     0,                                      /* mbInitRdIsModule */  
     0,                                      /* mbConcatArgs */  
     1,                                      /* mbAllowExtraInitRds */  
272  };  };
273    
274  struct configFileInfo siloConfigType = {  struct configFileInfo siloConfigType = {
275      "/etc/silo.conf",    /* defaultConfig */      .defaultConfig = "/etc/silo.conf",
276      siloKeywords,    /* keywords */      .keywords = siloKeywords,
277      0,    /* defaultIsIndex */      .entryStart = LT_KERNEL,
278      0,    /* defaultSupportSaved */      .needsBootPrefix = 1,
279      LT_KERNEL,    /* entrySeparator */      .argsInQuotes = 1,
280      1,    /* needsBootPrefix */      .maxTitleLength = 15,
     1,    /* argsInQuotes */  
     15,    /* maxTitleLength */  
     0,                                      /* titleBracketed */  
     0,                                      /* mbHyperFirst */  
     0,                                      /* mbInitRdIsModule */  
     0,                                      /* mbConcatArgs */  
     0,                                      /* mbAllowExtraInitRds */  
281  };  };
282    
283  struct configFileInfo ziplConfigType = {  struct configFileInfo ziplConfigType = {
284      "/etc/zipl.conf",    /* defaultConfig */      .defaultConfig = "/etc/zipl.conf",
285      ziplKeywords,    /* keywords */      .keywords = ziplKeywords,
286      0,    /* defaultIsIndex */      .entryStart = LT_TITLE,
287      0,    /* defaultSupportSaved */      .argsInQuotes = 1,
288      LT_TITLE,    /* entrySeparator */      .titleBracketed = 1,
     0,    /* needsBootPrefix */  
     1,    /* argsInQuotes */  
     0,    /* maxTitleLength */  
     1,                                      /* titleBracketed */  
     0,                                      /* mbHyperFirst */  
     0,                                      /* mbInitRdIsModule */  
     0,                                      /* mbConcatArgs */  
     0,                                      /* mbAllowExtraInitRds */  
289  };  };
290    
291  struct configFileInfo extlinuxConfigType = {  struct configFileInfo extlinuxConfigType = {
292      "/boot/extlinux/extlinux.conf",         /* defaultConfig */      .defaultConfig = "/boot/extlinux/extlinux.conf",
293      extlinuxKeywords,                       /* keywords */      .keywords = extlinuxKeywords,
294      0,                                      /* defaultIsIndex */      .entryStart = LT_TITLE,
295      0,                                      /* defaultSupportSaved */      .needsBootPrefix = 1,
296      LT_TITLE,                               /* entrySeparator */      .maxTitleLength = 255,
297      1,                                      /* needsBootPrefix */      .mbAllowExtraInitRds = 1,
     0,                                      /* argsInQuotes */  
     255,                                    /* maxTitleLength */  
     0,                                      /* titleBracketed */  
     0,                                      /* mbHyperFirst */  
     0,                                      /* mbInitRdIsModule */  
     0,                                      /* mbConcatArgs */  
     1,                                      /* mbAllowExtraInitRds */  
298  };  };
299    
300  struct grubConfig {  struct grubConfig {
# Line 484  static int isBracketedTitle(struct singl Line 437  static int isBracketedTitle(struct singl
437      return 0;      return 0;
438  }  }
439    
440  static int isEntrySeparator(struct singleLine * line,  static int isEntryStart(struct singleLine * line,
441                              struct configFileInfo * cfi) {                              struct configFileInfo * cfi) {
442      return line->type == cfi->entrySeparator || line->type == LT_OTHER ||      return line->type == cfi->entryStart || line->type == LT_OTHER ||
443   (cfi->titleBracketed && isBracketedTitle(line));   (cfi->titleBracketed && isBracketedTitle(line));
444  }  }
445    
# Line 809  static struct grubConfig * readConfig(co Line 762  static struct grubConfig * readConfig(co
762      cfg->secondaryIndent = strdup(line->indent);      cfg->secondaryIndent = strdup(line->indent);
763   }   }
764    
765   if (isEntrySeparator(line, cfi)) {   if (isEntryStart(line, cfi)) {
766      sawEntry = 1;      sawEntry = 1;
767      if (!entry) {      if (!entry) {
768   cfg->entries = malloc(sizeof(*entry));   cfg->entries = malloc(sizeof(*entry));
# Line 2720  int addNewKernel(struct grubConfig * con Line 2673  int addNewKernel(struct grubConfig * con
2673   /* don't have a template, so start the entry with the   /* don't have a template, so start the entry with the
2674   * appropriate starting line   * appropriate starting line
2675   */   */
2676   switch (config->cfi->entrySeparator) {   switch (config->cfi->entryStart) {
2677      case LT_KERNEL:      case LT_KERNEL:
2678   if (new->multiboot && config->cfi->mbHyperFirst) {   if (new->multiboot && config->cfi->mbHyperFirst) {
2679      /* fall through to LT_HYPER */      /* fall through to LT_HYPER */
# Line 2772  int addNewKernel(struct grubConfig * con Line 2725  int addNewKernel(struct grubConfig * con
2725    
2726      /* add the remainder of the lines, i.e. those that either      /* add the remainder of the lines, i.e. those that either
2727       * 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,
2728       * all the lines following the entrySeparator.       * all the lines following the entryStart.
2729       */       */
2730      if (needs & NEED_TITLE) {      if (needs & NEED_TITLE) {
2731   newLine = addLine(new, config->cfi, LT_TITLE,   newLine = addLine(new, config->cfi, LT_TITLE,

Legend:
Removed from v.1304  
changed lines
  Added in v.1693