From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KM7Ha-0006i6-AB for mharc-grub-devel@gnu.org; Thu, 24 Jul 2008 16:19:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KM7HY-0006hg-2i for grub-devel@gnu.org; Thu, 24 Jul 2008 16:19:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KM7HV-0006hT-OK for grub-devel@gnu.org; Thu, 24 Jul 2008 16:19:22 -0400 Received: from [199.232.76.173] (port=36921 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KM7HV-0006hQ-IG for grub-devel@gnu.org; Thu, 24 Jul 2008 16:19:21 -0400 Received: from mailout02.t-online.de ([194.25.134.17]:50561) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KM7HV-0004yi-0U for grub-devel@gnu.org; Thu, 24 Jul 2008 16:19:21 -0400 Received: from fwd34.aul.t-online.de by mailout02.sul.t-online.de with smtp id 1KM7HT-0007TS-03; Thu, 24 Jul 2008 22:19:19 +0200 Received: from [10.3.2.2] (JbU9QaZbwhuS7EfHPm4-d1BTMnOW-rupShJ+fvs0ZFA5gOP2SSfyaTwOr+FkMaJg1-@[217.235.193.217]) by fwd34.aul.t-online.de with esmtp id 1KM7HQ-1iG1iq0; Thu, 24 Jul 2008 22:19:16 +0200 Message-ID: <4888E3C5.9090707@t-online.de> Date: Thu, 24 Jul 2008 22:19:17 +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 Content-Type: multipart/mixed; boundary="------------030600020200020503030100" X-ID: JbU9QaZbwhuS7EfHPm4-d1BTMnOW-rupShJ+fvs0ZFA5gOP2SSfyaTwOr+FkMaJg1- X-TOI-MSGID: 13d03457-29cc-4ceb-85de-3ffbd837a478 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: [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, 24 Jul 2008 20:19:24 -0000 This is a multi-part message in MIME format. --------------030600020200020503030100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit This patch allows to run update-grub on Cygwin. Christian 2008-07-24 Christian Franke * 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. --------------030600020200020503030100 Content-Type: text/x-diff; name="grub2-update-Cygwin.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-update-Cygwin.patch" 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 --------------030600020200020503030100--