grub-devel
[Top][All Lists]
Advanced

[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, 24 Jul 2008 22:39:04 +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

Christian Franke wrote:
This patch allows to run update-grub on Cygwin.

... and here is a simple example for /etc/grub.d/10_cygwin

Only adds current OS yet.

Christian

diff --git a/util/grub.d/10_cygwin.in b/util/grub.d/10_cygwin.in
new file mode 100644
index 0000000..1dd1116
--- /dev/null
+++ b/util/grub.d/10_cygwin.in
@@ -0,0 +1,48 @@
+#! /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@
+
+grub_probe=${sbindir}/grub-probe
+
+case "`uname 2>/dev/null`" in
+  CYGWIN_NT-5.0) OS="Windows 2000" ;;
+  CYGWIN_NT-5.1) OS="Windows XP" ;;
+  CYGWIN*) OS="Windows" ;;
+  *) exit 0 ;;
+esac
+
+[ "$SYSTEMDRIVE" != "" ] || exit 0
+
+p="`cygpath -a "$SYSTEMDRIVE"`"
+
+[ -f "$p"/ntldr ] || exit 0
+
+d="`${grub_probe} -t drive "$p" 2>/dev/null`" || exit 0
+
+echo "Found $OS on $d" >&2
+cat << EOF
+menuentry "$OS" {
+       root=$d
+       chainloader +1
+}
+EOF
+

reply via email to

[Prev in Thread] Current Thread [Next in Thread]