Magellan Linux

Diff of /trunk/grubby/grubby.c

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

revision 2960 by niro, Wed Jun 29 14:07:59 2016 UTC revision 2977 by niro, Thu Jun 30 10:24:27 2016 UTC
# Line 582  struct keywordTypes extlinuxKeywords[] = Line 582  struct keywordTypes extlinuxKeywords[] =
582      { "initrd",    LT_INITRD,      ' ', ',' },      { "initrd",    LT_INITRD,      ' ', ',' },
583      { "append",    LT_KERNELARGS,  ' ' },      { "append",    LT_KERNELARGS,  ' ' },
584      { "prompt",     LT_UNKNOWN,     ' ' },      { "prompt",     LT_UNKNOWN,     ' ' },
585        { "fdt",        LT_DEVTREE,     ' ' },
586        { "fdtdir",     LT_DEVTREE,     ' ' },
587      { NULL,    0, 0 },      { NULL,    0, 0 },
588  };  };
589  int useextlinuxmenu;  int useextlinuxmenu;
# Line 827  static int isEntryStart(struct singleLin Line 829  static int isEntryStart(struct singleLin
829    
830  /* extract the title from within brackets (for zipl) */  /* extract the title from within brackets (for zipl) */
831  static char * extractTitle(struct singleLine * line) {  static char * extractTitle(struct singleLine * line) {
832      /* bracketed title... let's extract it (leaks a byte) */      /* bracketed title... let's extract it */
833      char * title = NULL;      char * title = NULL;
834      if (line->type == LT_TITLE) {      if (line->type == LT_TITLE) {
835   title = strdup(line->elements[0].item);   title = strdup(line->elements[0].item + 1);
  title++;  
836   *(title + strlen(title) - 1) = '\0';   *(title + strlen(title) - 1) = '\0';
837      } else if (line->type == LT_MENUENTRY)      } else if (line->type == LT_MENUENTRY)
838   title = strdup(line->elements[1].item);   title = strdup(line->elements[1].item);
# Line 2370  void displayEntry(struct singleEntry * e Line 2371  void displayEntry(struct singleEntry * e
2371      } else {      } else {
2372   char * title;   char * title;
2373   line = getLineByType(LT_MENUENTRY, entry->lines);   line = getLineByType(LT_MENUENTRY, entry->lines);
2374   title = grub2ExtractTitle(line);   if (line) {
2375   if (title)      title = grub2ExtractTitle(line);
2376      printf("title=%s\n", title);      if (title)
2377     printf("title=%s\n", title);
2378     }
2379      }      }
2380    
2381      for (j = 0, line = entry->lines; line; line = line->next) {      for (j = 0, line = entry->lines; line; line = line->next) {
# Line 3323  int addMBInitrd(struct grubConfig * cfg, Line 3326  int addMBInitrd(struct grubConfig * cfg,
3326    
3327   /* if title is supplied, the entry's title must match it. */   /* if title is supplied, the entry's title must match it. */
3328   if (title) {   if (title) {
3329        char *linetitle;
3330    
3331      line = getLineByType(LT_TITLE|LT_MENUENTRY, entry->lines);      line = getLineByType(LT_TITLE|LT_MENUENTRY, entry->lines);
3332      char *linetitle = extractTitle(line);      if (!line)
3333     continue;
3334    
3335        linetitle = extractTitle(line);
3336      if (!linetitle)      if (!linetitle)
3337   continue;   continue;
3338      if (strcmp(title, linetitle)) {      if (strcmp(title, linetitle)) {
# Line 3373  int updateInitrd(struct grubConfig * cfg Line 3380  int updateInitrd(struct grubConfig * cfg
3380    
3381   /* if title is supplied, the entry's title must match it. */   /* if title is supplied, the entry's title must match it. */
3382   if (title) {   if (title) {
3383        char *linetitle;
3384    
3385      line = getLineByType(LT_TITLE|LT_MENUENTRY, entry->lines);      line = getLineByType(LT_TITLE|LT_MENUENTRY, entry->lines);
3386      char *linetitle = extractTitle(line);      if (!line)
3387     continue;
3388    
3389        linetitle = extractTitle(line);
3390      if (!linetitle)      if (!linetitle)
3391   continue;   continue;
3392      if (strcmp(title, linetitle)) {      if (strcmp(title, linetitle)) {
# Line 4259  int main(int argc, const char ** argv) { Line 4270  int main(int argc, const char ** argv) {
4270      _("display the title of the default kernel") },      _("display the title of the default kernel") },
4271   { "devtree", 0, POPT_ARG_STRING, &newDevTreePath, 0,   { "devtree", 0, POPT_ARG_STRING, &newDevTreePath, 0,
4272      _("device tree file for new stanza"), _("dtb-path") },      _("device tree file for new stanza"), _("dtb-path") },
4273     { "devtreedir", 0, POPT_ARG_STRING, &newDevTreePath, 0,
4274        _("device tree directory for new stanza"), _("dtb-path") },
4275   { "elilo", 0, POPT_ARG_NONE, &configureELilo, 0,   { "elilo", 0, POPT_ARG_NONE, &configureELilo, 0,
4276      _("configure elilo bootloader") },      _("configure elilo bootloader") },
4277   { "efi", 0, POPT_ARG_NONE, &isEfi, 0,   { "efi", 0, POPT_ARG_NONE, &isEfi, 0,

Legend:
Removed from v.2960  
changed lines
  Added in v.2977