All of 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: [PATCH] update-grub for Cygwin
Date: Thu, 24 Jul 2008 22:19:17 +0200	[thread overview]
Message-ID: <4888E3C5.9090707@t-online.de> (raw)

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

This patch allows to run update-grub on Cygwin.

Christian

2008-07-24  Christian Franke  <franke@computer.org>

	* util/update-grub.in: Add a check for admin
	group for Cygwin.
	Add `-f' to `rm' and `mv' of grub.cfg to handle
	the different filesystem semantics on Windows.



[-- Attachment #2: grub2-update-Cygwin.patch --]
[-- Type: text/x-diff, Size: 1268 bytes --]

diff --git a/util/update-grub.in b/util/update-grub.in
index c78444e..70607a5 100644
--- a/util/update-grub.in
+++ b/util/update-grub.in
@@ -73,8 +73,20 @@ if [ "x$EUID" = "x" ] ; then
 fi
 
 if [ "$EUID" != 0 ] ; then
-  echo "$0: You must run this as root" >&2
-  exit 1
+  root=f
+  case "`uname 2>/dev/null`" in
+    CYGWIN*)
+      # Cygwin: Assume root if member of admin group
+      for g in `id -G 2>/dev/null` ; do
+	case $g in
+	  0|544) root=t ;;
+	esac
+      done ;;
+  esac
+  if [ $root != t ] ; then
+    echo "$0: You must run this as root" >&2
+    exit 1
+  fi
 fi
 
 set $grub_mkdevicemap dummy
@@ -154,6 +166,7 @@ export GRUB_DEVICE GRUB_DEVICE_UUID GRUB_DEVICE_BOOT GRUB_DEVICE_BOOT_UUID GRUB_
 # These are optional, user-defined variables.
 export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_TERMINAL GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID
 
+rm -f ${grub_cfg}.new
 exec > ${grub_cfg}.new
 
 # Allow this to fail, since /boot/grub/ might need to be fatfs to support some
@@ -187,6 +200,6 @@ for i in ${update_grub_dir}/* ; do
 done
 
 # none of the children aborted with error, install the new grub.cfg
-mv ${grub_cfg}.new ${grub_cfg}
+mv -f ${grub_cfg}.new ${grub_cfg}
 
 echo "done" >&2

             reply	other threads:[~2008-07-24 20:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 20:19 Christian Franke [this message]
2008-07-24 20:39 ` [PATCH] update-grub for Cygwin Christian Franke
2008-07-25 20:42   ` Robert Millan
2008-07-31 21:32     ` Christian Franke
2008-08-04 19:46       ` Christian Franke
2008-08-04 20:00         ` Robert Millan
2008-08-04 20:40           ` Christian Franke
2008-08-04 21:41             ` Robert Millan
2008-08-05 12:13               ` Christian Franke
2008-08-05 20:09                 ` Robert Millan
2008-08-06 18:48                   ` Christian Franke
2008-07-25 20:40 ` Robert Millan
2008-07-26 12:53   ` Christian Franke
2008-07-27  6:09     ` Pavel Roskin
2008-07-27 12:39       ` Robert Millan
2008-07-29 15:40         ` 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=4888E3C5.9090707@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.