2007-05-11 Robert Millan <rmh@aybabtu.com>

* util/update-grub.in: Create device.map if it doesn't already exist,
	before attempting to run grub-probe.
	Check for grub-probe and grub-mkdevicemap with the same code
	grub-install is using.
	Remove test mode.
This commit is contained in:
robertmh 2007-05-11 15:53:02 +00:00
parent 3f6a10ef11
commit 2e610d6273
2 changed files with 34 additions and 26 deletions

View file

@ -1,3 +1,11 @@
2007-05-11 Robert Millan <rmh@aybabtu.com>
* util/update-grub.in: Create device.map if it doesn't already exist,
before attempting to run grub-probe.
Check for grub-probe and grub-mkdevicemap with the same code
grub-install is using.
Remove test mode.
2007-05-09 Jeroen Dekkers <jeroen@dekkers.cx> 2007-05-09 Jeroen Dekkers <jeroen@dekkers.cx>
* Makefile.in: Add the datarootdir autoconf variable. * Makefile.in: Add the datarootdir autoconf variable.

View file

@ -19,11 +19,16 @@
transform="@program_transform_name@" transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
sbindir=@sbindir@
sysconfdir=@sysconfdir@ sysconfdir=@sysconfdir@
grub_prefix=`echo /boot/grub | sed ${transform}` grub_prefix=`echo /boot/grub | sed ${transform}`
grub_cfg=${grub_prefix}/grub.cfg grub_cfg=${grub_prefix}/grub.cfg
update_grub_dir=${sysconfdir}/grub.d update_grub_dir=${sysconfdir}/grub.d
test_mode=false
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
if [ "x$UID" = "x" ] ; then if [ "x$UID" = "x" ] ; then
UID=`id -u` UID=`id -u`
@ -38,34 +43,31 @@ if [ "$1" = "-y" ] ; then
echo "$0: warning: Ignoring -y option (no longer needed)." >&2 echo "$0: warning: Ignoring -y option (no longer needed)." >&2
fi fi
if test -d ${update_grub_dir} ; then : ; else set $grub_mkdevicemap dummy
if test -d ./grub.d ; then if test -f "$1"; then
update_grub_dir=./grub.d :
test_mode=true else
fi echo "$1: Not found." 1>&2
exit 1
fi fi
found=false set $grub_probe dummy
old_IFS="$IFS" if test -f "$1"; then
IFS=: :
for i in $PATH ; do else
if test -x "$i/grub-probe" ; then echo "$1: Not found." 1>&2
found=true exit 1
break
fi
done
IFS="$old_IFS"
if ${found} ; then : ; else
echo "$0: grub-probe not found in PATH." >&2
exit 1
fi fi
if ${test_mode} ; then : ; else mkdir -p ${grub_prefix}
mkdir -p ${grub_prefix}
exec > ${grub_cfg}.new if test -e ${grub_prefix}/device.map ; then : ; else
chmod 444 ${grub_cfg}.new grub-mkdevicemap
fi fi
exec > ${grub_cfg}.new
chmod 444 ${grub_cfg}.new
if test -f ${sysconfdir}/default/grub ; then if test -f ${sysconfdir}/default/grub ; then
. ${sysconfdir}/default/grub . ${sysconfdir}/default/grub
fi fi
@ -100,8 +102,6 @@ for i in ${update_grub_dir}/* ; do
done done
# none of the children aborted with error, install the new grub.cfg # none of the children aborted with error, install the new grub.cfg
if ${test_mode} ; then : ; else mv ${grub_cfg}.new ${grub_cfg}
mv ${grub_cfg}.new ${grub_cfg}
fi
echo "done" >&2 echo "done" >&2