2010-09-08 Robert Millan <rmh@gnu.org>

* util/grub-mkconfig_lib.in (is_path_readable_by_grub): Improve
	with (optional) parameters to specify device and relative path.
	* util/grub-install.in: Use is_path_readable_by_grub() to
	verify readability of a few critical files.
	* util/grub-mkconfig.in: Use is_path_readable_by_grub() to
	verify readability of grub.cfg.new.
This commit is contained in:
Robert Millan 2010-09-08 23:35:53 +02:00
parent 27f21a8bb6
commit 6b8e78aee3
4 changed files with 34 additions and 5 deletions

View file

@ -53,16 +53,23 @@ make_system_path_relative_to_its_root ()
is_path_readable_by_grub ()
{
path=$1
device=$2
relpath=$3
# abort if path doesn't exist
if test -e $path ; then : ;else
return 1
fi
if [ "${device}" = "" ] ; then
device=$(${grub_probe} --target=device $path)
fi
if [ "${relpath}" = "" ] ; then
relpath=$(${grub_mkrelpath} $path)
fi
# abort if file read through GRUB doesn't match file read through system
# facilities
device=$(${grub_probe} --target=device $path)
relpath=$(${grub_mkrelpath} $path)
if ${grub_fstest} $device cmp $relpath $path > /dev/null 2>&1 ; then : ; else
return 1
fi