This would be very useful to get rid of ugly kludges in Debian, such as this
one:
  
http://svn.debian.org/wsvn/pkg-grub/grub2/trunk/debian/update-grub?op=file&rev=0&sc=0
  (look for convert() here)

Fortunately grub-probefs is already doing what we need, we just need a way to
tell it to print the information.

2006-09-22  Robert Millan  <[EMAIL PROTECTED]>

        * util/i386/pc/grub-probefs.c: Add -r|--root-device option (print
        guessed root device and exit).

-- 
Robert Millan

My spam trap is [EMAIL PROTECTED]  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.
2006-09-22  Robert Millan  <[EMAIL PROTECTED]>

        * util/i386/pc/grub-probefs.c: Add -r|--root-device option (print
        guessed root device and exit).

Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v
retrieving revision 1.3
diff -u -r1.3 grub-probefs.c
--- util/i386/pc/grub-probefs.c 23 Apr 2006 13:37:36 -0000      1.3
+++ util/i386/pc/grub-probefs.c 22 Sep 2006 16:05:08 -0000
@@ -47,6 +47,8 @@
 
 #define DEFAULT_DEVICE_MAP     DEFAULT_DIRECTORY "/device.map"
 
+int print_root = 0;
+
 void
 grub_putchar (int c)
 {
@@ -84,6 +86,12 @@
       return;
     }
 
+  if (print_root)
+    {
+      printf ("(%s)\n", device_name);
+      return;
+    }
+
   grub_util_info ("opening %s", device_name);
   dev = grub_device_open (device_name);
   if (! dev)
@@ -121,6 +129,7 @@
 Probe a filesystem module for a given path.\n\
 \n\
   -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
+  -r, --root-device         print guessed root device and exit\n\
   -h, --help                display this message and exit\n\
   -V, --version             print version information and exit\n\
   -v, --verbose             print verbose messages\n\
@@ -143,7 +152,7 @@
   /* Check for options.  */
   while (1)
     {
-      int c = getopt_long (argc, argv, "m:hVv", options, 0);
+      int c = getopt_long (argc, argv, "m:rhVv", options, 0);
       
       if (c == -1)
        break;
@@ -157,6 +166,10 @@
            dev_map = xstrdup (optarg);
            break;
 
+         case 'r':
+           print_root=1;
+           break;
+
          case 'h':
            usage (0);
            break;
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to