From b609876d153e9240ae4dbcf02698cd6ba3501df1 Mon Sep 17 00:00:00 2001 From: chrfranke Date: Tue, 29 Jul 2008 15:38:05 +0000 Subject: [PATCH] 2008-07-29 Christian Franke * util/update-grub.in: Add a check for admin group on Cygwin. Remove old `grub.cfg.new' before creation. Add `-f' to `mv' to handle the different filesystem semantics of Windows. --- ChangeLog | 8 ++++++++ util/update-grub.in | 19 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 488c56c6b..985b30ac7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-07-29 Christian Franke + + * util/update-grub.in: Add a check for admin + group on Cygwin. + Remove old `grub.cfg.new' before creation. + Add `-f' to `mv' to handle the different filesystem + semantics of Windows. + 2008-07-29 Bean * normal/main.c (get_line): Fix buffer overflow bug. diff --git a/util/update-grub.in b/util/update-grub.in index c78444e19..70607a50e 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 -- 2.39.5