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>
* Makefile.in: Add the datarootdir autoconf variable.

View file

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