All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Zielcke <fzielcke@z-51.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] add drivemap support to 30_os-prober.in and use UUIDs
Date: Sun, 07 Jun 2009 17:37:59 +0200	[thread overview]
Message-ID: <1244389079.3791.7.camel@fz.local> (raw)

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

Attached patch uses `prepare_grub_to_access_device' to set the root in
the generated entrys.
And it adds drivemap to the chainload ones, if root isn't (hd0).

The Debian grub-installer adds map only with Dos and Windows, should I
do the same or is it okay to do it for all?

-# update-grub helper script.
+# grub-mkconfig helper script.
Does this needs to be mentioned in ChangeLog?
-- 
Felix Zielcke

[-- Attachment #2: os-prober.patch --]
[-- Type: text/x-patch, Size: 2504 bytes --]

2009-06-07  Felix Zielcke  <fzielcke@z-51.de>

	    * util/grub.d/30_os-prober.in: Source
	    ${libdir}/grub/grub-mkconfig_lib.  Use prepare_grub_to_access_device
	    to set the root device.

diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 7d4d17e..9a6dff4 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
-# update-grub helper script.
-# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
+# grub-mkconfig helper script.
+# Copyright (C) 2006,2007,2008,2009  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,6 +16,12 @@
 # You should have received a copy of the GNU General Public License
 # along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+
+. ${libdir}/grub/grub-mkconfig_lib
+
 if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
   # missing os-prober and/or linux-boot-prober
   exit 0
@@ -45,7 +51,15 @@ for OS in ${OSPROBED} ; do
 
       cat << EOF
 menuentry "${LONGNAME} (on ${DEVICE})" {
-	set root=${CHAINROOT}
+EOF
+      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+
+      if [ `echo ${CHAINROOT} | sed -e 's/,[0-9]*[a-z]*//g'` != "(hd0)" ] ; then
+	  cat << EOF
+	  drivemap -s (hd0) \$root
+EOF
+      fi
+      cat << EOF
 	chainloader +1
 }
 EOF
@@ -61,15 +75,15 @@ EOF
         LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
         LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"
 
-        LINUXROOT="`grub-probe --target=drive --device ${LBOOT} 2> /dev/null`"
-
         if [ -z "${LLABEL}" ] ; then
           LLABEL="${LONGNAME}"
         fi
 
         cat << EOF
 menuentry "${LLABEL} (on ${DEVICE})" {
-	set root=${LINUXROOT}
+EOF
+	prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+	cat <<  EOF
 	linux ${LKERNEL} ${LPARAMS}
 EOF
         if [ -n "${LINITRD}" ] ; then
@@ -88,7 +102,9 @@ EOF
       OSXDISK=disk"`echo ${OSXROOT} | awk -F , '{ print $1 ; }' | sed 's/(hd//;'`"s"`echo ${OSXROOT} | awk -F , '{ print $2 ; }' | sed 's/)//;'`"
         cat << EOF
 menuentry "${LONGNAME} (on ${DEVICE})" {
-	set root=${OSXROOT}
+EOF
+	prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+	cat << EOF
         insmod vbe
         do_resume=0
         if [ /var/vm/sleepimage -nt10 / ]; then

             reply	other threads:[~2009-06-07 15:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-07 15:37 Felix Zielcke [this message]
2009-06-07 15:55 ` [PATCH] add drivemap support to 30_os-prober.in and use UUIDs Pavel Roskin
2009-06-08 10:54   ` Vladimir 'phcoder' Serbinenko
2009-06-09 20:21     ` Felix Zielcke
2009-06-09 20:34       ` Pavel Roskin
2009-06-11 19:00 ` Felix Zielcke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244389079.3791.7.camel@fz.local \
    --to=fzielcke@z-51.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.