Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1GQnxk-0002yH-JV for mharc-grub-devel@gnu.org; Fri, 22 Sep 2006 12:33:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GQnxj-0002ux-OR for grub-devel@gnu.org; Fri, 22 Sep 2006 12:33:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GQnxi-0002s9-Sa for grub-devel@gnu.org; Fri, 22 Sep 2006 12:33:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GQnxi-0002ra-Kk for grub-devel@gnu.org; Fri, 22 Sep 2006 12:33:14 -0400 Received: from [69.60.117.155] (helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GQo1U-0003zA-P3 for grub-devel@gnu.org; Fri, 22 Sep 2006 12:37:08 -0400 Received: from 138.red-62-57-141.user.auna.net ([62.57.141.138] helo=khazad.dyndns.org) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.63) (envelope-from ) id 1GQnxS-00050x-UL for grub-devel@gnu.org; Fri, 22 Sep 2006 18:32:59 +0200 Received: from rmh by khazad.dyndns.org with local (Exim 4.63) (envelope-from ) id 1GQnxm-0007cF-Lq for grub-devel@gnu.org; Fri, 22 Sep 2006 18:33:18 +0200 Date: Fri, 22 Sep 2006 18:33:13 +0200 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20060922163313.GA29160@khazad.dyndns.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline Organization: free as in freedom X-Message-Flag: Microsoft discourages use of Outlook. User-Agent: Mutt/1.5.13 (2006-08-11) Subject: [PATCH] grub-probefs --root-device X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2006 16:33:16 -0000 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 * util/i386/pc/grub-probefs.c: Add -r|--root-device option (print guessed root device and exit). -- Robert Millan My spam trap is honeypot@aybabtu.com. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="print_root.diff" 2006-09-22 Robert Millan * 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; --AhhlLboLdkugWU4S--