Magellan Linux

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

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

trunk/mkinitrd-magellan/grubby/grubby.c revision 1177 by niro, Wed Dec 15 21:16:32 2010 UTC trunk/grubby/grubby.c revision 1692 by niro, Fri Feb 17 23:14:54 2012 UTC
# 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 */      .entrySeparator = 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 */      .entrySeparator = 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 */      .entrySeparator = 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 */      .entrySeparator = 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 */      .entrySeparator = 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 */      .entrySeparator = 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 */      .entrySeparator = 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 1979  int updateActualImage(struct grubConfig Line 1932  int updateActualImage(struct grubConfig
1932      const char ** arg;      const char ** arg;
1933      int useKernelArgs, useRoot;      int useKernelArgs, useRoot;
1934      int firstElement;      int firstElement;
1935      int *usedElements, *usedArgs;      int *usedElements;
1936      int doreplace;      int doreplace;
1937    
1938      if (!image) return 0;      if (!image) return 0;
# Line 2014  int updateActualImage(struct grubConfig Line 1967  int updateActualImage(struct grubConfig
1967      useRoot = (getKeywordByType(LT_ROOT, cfg->cfi)      useRoot = (getKeywordByType(LT_ROOT, cfg->cfi)
1968         && !multibootArgs);         && !multibootArgs);
1969    
     for (k = 0, arg = newArgs; *arg; arg++, k++) ;  
     usedArgs = calloc(k, sizeof(*usedArgs));  
   
1970      for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) {      for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) {
1971    
1972   if (multibootArgs && !entry->multiboot)   if (multibootArgs && !entry->multiboot)
# Line 2092  int updateActualImage(struct grubConfig Line 2042  int updateActualImage(struct grubConfig
2042          usedElements = calloc(line->numElements, sizeof(*usedElements));          usedElements = calloc(line->numElements, sizeof(*usedElements));
2043    
2044   for (k = 0, arg = newArgs; *arg; arg++, k++) {   for (k = 0, arg = newArgs; *arg; arg++, k++) {
             if (usedArgs[k]) continue;  
2045    
2046      doreplace = 1;      doreplace = 1;
2047      for (i = firstElement; i < line->numElements; i++) {      for (i = firstElement; i < line->numElements; i++) {
# Line 2107  int updateActualImage(struct grubConfig Line 2056  int updateActualImage(struct grubConfig
2056                      continue;                      continue;
2057   if (!argMatch(line->elements[i].item, *arg)) {   if (!argMatch(line->elements[i].item, *arg)) {
2058                      usedElements[i]=1;                      usedElements[i]=1;
                     usedArgs[k]=1;  
2059      break;      break;
2060                  }                  }
2061              }              }
# Line 2177  int updateActualImage(struct grubConfig Line 2125  int updateActualImage(struct grubConfig
2125   }   }
2126      }      }
2127    
     free(usedArgs);  
2128      free(newArgs);      free(newArgs);
2129      free(oldArgs);      free(oldArgs);
2130    

Legend:
Removed from v.1177  
changed lines
  Added in v.1692