]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Add network functions for grub-menulst2cfg
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 5 Oct 2011 08:21:32 +0000 (10:21 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 5 Oct 2011 08:21:32 +0000 (10:21 +0200)
grub-core/lib/legacy_parse.c

index 659fa7061a9ec7db0bb671ba7fb980e64114ede7..e3f4864ceca5741b17d098f6bf8c12694b2de9d0 100644 (file)
@@ -42,7 +42,8 @@ struct legacy_command
     TYPE_BOOL,
     TYPE_INT,
     TYPE_REST_VERBATIM,
-    TYPE_VBE_MODE
+    TYPE_VBE_MODE,
+    TYPE_WITH_CONFIGFILE_OPTION
   } argt[4];
   enum {
     FLAG_IGNORE_REST        =  0x001,
@@ -64,7 +65,13 @@ static struct legacy_command legacy_commands[] =
      "Print the blocklist notation of the file FILE."},
     {"boot", "boot\n", NULL, 0, 0, {}, 0, 0,
      "Boot the OS/chain-loader which has been loaded."},
-    /* FIXME: bootp unsupported.  */
+    {"bootp", "net_bootp; net_ls_addr; if [ x%s = x--with-configfile ]; then "
+     "if net_get_dhcp_option configfile_name pxe 150 string; then "
+     "configfile $configfile_name; fi; fi\n", NULL, 0, 1,
+     {TYPE_WITH_CONFIGFILE_OPTION}, FLAG_IGNORE_REST, "[--with-configfile]",
+     "Initialize a network device via BOOTP. If the option `--with-configfile'"
+     " is given, try to load a configuration file specified by the 150 vendor"
+     " tag."},
     {"cat", "cat '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE",
      "Print the contents of the file FILE."},
     {"chainloader", "chainloader %s '%s'\n", NULL, 0,
@@ -102,7 +109,13 @@ static struct legacy_command legacy_commands[] =
      "[NUM | `saved']",
      "Set the default entry to entry number NUM (if not specified, it is"
      " 0, the first entry) or the entry number saved by savedefault."},
-    /* FIXME: dhcp unsupported.  */
+    {"dhcp", "net_bootp; net_ls_addr; if [ x%s = x--with-configfile ]; then "
+     "if net_get_dhcp_option configfile_name pxe 150 string; then "
+     "configfile $configfile_name; fi; fi\n", NULL, 0, 1,
+     {TYPE_WITH_CONFIGFILE_OPTION}, FLAG_IGNORE_REST, "[--with-configfile]",
+     "Initialize a network device via BOOTP. If the option `--with-configfile'"
+     " is given, try to load a configuration file specified by the 150 vendor"
+     " tag."},
     {"displayapm", "lsapm\n", NULL, 0, 0, {}, 0, 0,
      "Display APM BIOS information."},
     {"displaymem", "lsmmap\n", NULL, 0, 0, {}, 0, 0, 
@@ -411,6 +424,8 @@ is_option (enum arg_type opt, const char *curarg, grub_size_t len)
 {
   switch (opt)
     {
+    case TYPE_WITH_CONFIGFILE_OPTION:
+      return check_option (curarg, "--with-configfile", len);
     case TYPE_NOAPM_OPTION:
       return check_option (curarg, "--no-apm", len);
     case TYPE_FORCE_OPTION:
@@ -662,6 +677,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
          case TYPE_VERBATIM:
            args[i] = grub_legacy_escape (curarg, curarglen);
            break;
+         case TYPE_WITH_CONFIGFILE_OPTION:
          case TYPE_FORCE_OPTION:
          case TYPE_NOAPM_OPTION:
          case TYPE_TYPE_OR_NOMEM_OPTION:
@@ -756,6 +772,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
       case TYPE_FILE:
       case TYPE_REST_VERBATIM:
       case TYPE_VERBATIM:
+      case TYPE_WITH_CONFIGFILE_OPTION:
       case TYPE_FORCE_OPTION:
       case TYPE_NOAPM_OPTION:
       case TYPE_TYPE_OR_NOMEM_OPTION: