From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KNEF7-0007WF-PW for mharc-grub-devel@gnu.org; Sun, 27 Jul 2008 17:57:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KNEF6-0007Ud-06 for grub-devel@gnu.org; Sun, 27 Jul 2008 17:57:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KNEF3-0007UR-Ku for grub-devel@gnu.org; Sun, 27 Jul 2008 17:57:26 -0400 Received: from [199.232.76.173] (port=34086 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNEF3-0007UO-He for grub-devel@gnu.org; Sun, 27 Jul 2008 17:57:25 -0400 Received: from mailout10.t-online.de ([194.25.134.21]:57820) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KNEF3-0007jM-84 for grub-devel@gnu.org; Sun, 27 Jul 2008 17:57:25 -0400 Received: from fwd26.aul.t-online.de by mailout10.sul.t-online.de with smtp id 1KNEF0-0005FV-03; Sun, 27 Jul 2008 23:57:22 +0200 Received: from [10.3.2.2] (GcdFJyZOQhK5hdtETk22SxJeME5TxokP0NHXngl3dX837aY3bTvHHCGby4COSXhwtt@[217.235.206.212]) by fwd26.aul.t-online.de with esmtp id 1KNEEs-21yK7E0; Sun, 27 Jul 2008 23:57:14 +0200 Message-ID: <488CEF3B.7080008@t-online.de> Date: Sun, 27 Jul 2008 23:57:15 +0200 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071128 SeaMonkey/1.1.7 MIME-Version: 1.0 To: The development of GRUB 2 References: <4883322E.6040606@t-online.de> <20080722215200.GA15825@thorin> In-Reply-To: <20080722215200.GA15825@thorin> Content-Type: multipart/mixed; boundary="------------080304000904060607020302" X-ID: GcdFJyZOQhK5hdtETk22SxJeME5TxokP0NHXngl3dX837aY3bTvHHCGby4COSXhwtt X-TOI-MSGID: ad57c4a5-ce4c-4ffc-a2b8-6ba20e4da7f3 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [PATCH] grub-probe -t prefix, fix update-grub_lib for Cygwin 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: Sun, 27 Jul 2008 21:57:28 -0000 This is a multi-part message in MIME format. --------------080304000904060607020302 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 >> >> * 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 --------------080304000904060607020302 Content-Type: text/x-diff; name="grub2-prefix-3.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-prefix-3.patch" 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 () --------------080304000904060607020302--