From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KOflJ-0007tE-8v for mharc-grub-devel@gnu.org; Thu, 31 Jul 2008 17:32:41 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KOflI-0007r7-5N for grub-devel@gnu.org; Thu, 31 Jul 2008 17:32:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KOflG-0007nl-Kz for grub-devel@gnu.org; Thu, 31 Jul 2008 17:32:39 -0400 Received: from [199.232.76.173] (port=48830 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOflG-0007nS-Be for grub-devel@gnu.org; Thu, 31 Jul 2008 17:32:38 -0400 Received: from mailout06.t-online.de ([194.25.134.19]:52243) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KOflG-0000cY-4Q for grub-devel@gnu.org; Thu, 31 Jul 2008 17:32:38 -0400 Received: from fwd34.aul.t-online.de by mailout06.sul.t-online.de with smtp id 1KOflD-0004d7-00; Thu, 31 Jul 2008 23:32:35 +0200 Received: from [10.3.2.2] (ZCSqvyZ6ZhmjMyCf2gH+ZPD8us5ISFjMN+S7qFOqVSZsAVnnSYX09zsKv4s2w3QQrH@[217.235.223.65]) by fwd34.aul.t-online.de with esmtp id 1KOfl0-2FRReC0; Thu, 31 Jul 2008 23:32:22 +0200 Message-ID: <48922F66.4050803@t-online.de> Date: Thu, 31 Jul 2008 23:32:22 +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: <4888E3C5.9090707@t-online.de> <4888E868.10404@t-online.de> <20080725204222.GE18149@thorin> In-Reply-To: <20080725204222.GE18149@thorin> Content-Type: multipart/mixed; boundary="------------080100030609000403050507" X-ID: ZCSqvyZ6ZhmjMyCf2gH+ZPD8us5ISFjMN+S7qFOqVSZsAVnnSYX09zsKv4s2w3QQrH X-TOI-MSGID: ea08f144-c72f-4ff4-8baa-9c237d609d71 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [PATCH] update-grub 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: Thu, 31 Jul 2008 21:32:40 -0000 This is a multi-part message in MIME format. --------------080100030609000403050507 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Robert Millan wrote: > On Thu, Jul 24, 2008 at 10:39:04PM +0200, Christian Franke wrote: > >> + >> +d="`${grub_probe} -t drive "$p" 2>/dev/null`" || exit 0 >> > > Please avoid reliing on '-t drive'. It's based on device.map which just > contains guesswork. > > prepare_grub_to_access_device() is a much better option. > > Yes. Thanks for the info. New version below. Christian 2008-07-31 Christian Franke * conf/common.rmk: Add `10_cygwin' to `update-grub_SCRIPTS'. * util/grub.d/10_cygwin.in: New file. --------------080100030609000403050507 Content-Type: text/x-diff; name="grub2-10_cygwin-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-10_cygwin-2.patch" diff --git a/conf/common.rmk b/conf/common.rmk index 7db0b2a..0f74f1a 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -120,7 +120,7 @@ CLEANFILES += update-grub_lib %: util/grub.d/%.in config.status ./config.status --file=$@:$< chmod +x $@ -update-grub_SCRIPTS = 00_header 10_linux 10_hurd 30_os-prober 40_custom +update-grub_SCRIPTS = 00_header 10_cygwin 10_linux 10_hurd 30_os-prober 40_custom CLEANFILES += $(update-grub_SCRIPTS) update-grub_DATA += util/grub.d/README diff --git a/util/grub.d/10_cygwin.in b/util/grub.d/10_cygwin.in new file mode 100644 index 0000000..7dee6c1 --- /dev/null +++ b/util/grub.d/10_cygwin.in @@ -0,0 +1,52 @@ +#! /bin/sh -e + +# update-grub helper script. +# Copyright (C) 2008 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +. ${libdir}/grub/update-grub_lib + +case "`uname 2>/dev/null`" in + CYGWIN_NT-5.0) OS="Windows 2000" ;; + CYGWIN_NT-5.1) OS="Windows XP" ;; + CYGWIN_NT-5.2) OS="Windows 2003" ;; + CYGWIN*) OS="Windows" ;; + *) exit 0 ;; +esac + +case "$SYSTEMDRIVE" in + [A-Za-z]:) ;; + *) exit 0 ;; +esac + +test -f "$SYSTEMDRIVE"/ntldr || exit 0 + +sysdev=`${grub_probe} -t device "$SYSTEMDRIVE"/ 2>/dev/null` || exit 0 + +echo "Found $OS on $SYSTEMDRIVE/ ($sysdev)" >&2 +cat << EOF +menuentry "$OS" { +EOF + +prepare_grub_to_access_device "$sysdev" | sed 's,^,\t,' + +cat << EOF + chainloader +1 +} +EOF + --------------080100030609000403050507--