Grub Development Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] grub-probe -t prefix, fix update-grub_lib for Cygwin
Date: Sun, 27 Jul 2008 23:57:15 +0200	[thread overview]
Message-ID: <488CEF3B.7080008@t-online.de> (raw)
In-Reply-To: <20080722215200.GA15825@thorin>

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

Robert Millan wrote:
> On Sun, Jul 20, 2008 at 02:40:14PM +0200, Christian Franke wrote:
>   
>> The shell function make_system_path_relative_to_its_root() does not work 
>> on Cygwin due to path mapping (e.g. /boot/grub/ is actually 
>> /cygwin/boot/grub).
>>
>> This patch adds '-t prefix' to grub-probe. It prints result from 
>> grub_get_prefix() which is already extended for Cygwin (svn rev 1584).
>> The result is used in make_system_path_relative_to_its_root(). This 
>> keeps the platform dependent code in getroot.c.
>>
>> Christian
>>
>> 2008-07-20	Christian Franke  <franke@computer.org>
>>
>> 	* util/grub-probe.c (enum): Add PRINT PREFIX.
>> 	(probe): Add PRINT_PREFIX, prints result of
>> 	grub_get_prefix ().
>> 	(usage): Add `prefix' to `-t' usage text.
>> 	Add some '\n' to avoid excess long lines.
>> 	(main): Add check for `-t prefix' option.
>>     
>
> This is different than the usual grub-probe usage in that it doesn't operate
> on a device.  Perhaps it would make sense to add the functionality you want in
> a separate utility?
>
> I have an increasing feeling that grub-probe is becoming bloated (though I
> admit, this is mostly my fault)
>
>   

Here is a version with works without grub-probe.

Christian


[-- Attachment #2: grub2-prefix-3.patch --]
[-- Type: text/x-diff, Size: 889 bytes --]

diff --git a/util/update-grub_lib.in b/util/update-grub_lib.in
index 03a96ce..9d0f0c6 100644
--- a/util/update-grub_lib.in
+++ b/util/update-grub_lib.in
@@ -68,7 +68,22 @@ make_system_path_relative_to_its_root ()
     dir=""
   fi
 
-  echo $path | sed -e "s,^$dir,,g"
+  # XXX: This fails if $dir contains ','.
+  path=`echo "$path" | sed -e "s,^$dir,,g"` || return 1
+
+  case "`uname 2>/dev/null`" in
+    CYGWIN*)
+      # Cygwin: Check if regular or emulated mount.
+      if [ -z "$dir" ] || [ "`stat -c %D "$dir/.."`" != 620000 ] ; then
+        # Reached some mount point not below /cygdrive.
+        # GRUB does not know Cygwin's emulated mounts,
+        # convert to Win32 path and remove drive letter.
+        path=`cygpath -m "$path" | sed -n 's,^[A-Za-z]:,,p'`
+        test ! -z "$path" || return 1
+      fi ;;
+  esac
+
+  echo "$path"
 }
 
 is_path_readable_by_grub ()

  parent reply	other threads:[~2008-07-27 21:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-20 12:40 [PATCH] grub-probe -t prefix, fix update-grub_lib for Cygwin Christian Franke
2008-07-22 21:52 ` Robert Millan
2008-07-23  5:44   ` Christian Franke
2008-07-24 17:54     ` Christian Franke
2008-07-27 21:57   ` Christian Franke [this message]
2008-07-29 16:51     ` Christian Franke

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=488CEF3B.7080008@t-online.de \
    --to=christian.franke@t-online.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox