All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] update-grub for Cygwin
@ 2008-07-24 20:19 Christian Franke
  2008-07-24 20:39 ` Christian Franke
  2008-07-25 20:40 ` Robert Millan
  0 siblings, 2 replies; 16+ messages in thread
From: Christian Franke @ 2008-07-24 20:19 UTC (permalink / raw)
  To: The development of GRUB 2

[-- 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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-08-06 18:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-24 20:19 [PATCH] update-grub for Cygwin Christian Franke
2008-07-24 20:39 ` 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

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.