[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] update-grub for Cygwin
From: |
Christian Franke |
Subject: |
Re: [PATCH] update-grub for Cygwin |
Date: |
Thu, 31 Jul 2008 23:32:22 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071128 SeaMonkey/1.1.7 |
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 <address@hidden>
* conf/common.rmk: Add `10_cygwin' to `update-grub_SCRIPTS'.
* util/grub.d/10_cygwin.in: New file.
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 <http://www.gnu.org/licenses/>.
+
address@hidden@
address@hidden@
address@hidden@
+. ${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
+