From b0346e0f431fd71173160e6736a87d8232ccb3c1 Mon Sep 17 00:00:00 2001 From: robertmh Date: Tue, 6 May 2008 13:44:11 +0000 Subject: [PATCH] 2008-05-06 Robert Millan * util/update-grub_lib.in (make_system_path_relative_to_its_root): Do not print a trailing slash (therefore, the root directory is an empty string). (convert_system_path_to_grub_path): Do not remove trailing slash from make_system_path_relative_to_its_root() output. * util/i386/pc/grub-install.in: Add trailing slash to output from make_system_path_relative_to_its_root(). --- ChangeLog | 11 +++++++++++ util/i386/pc/grub-install.in | 2 +- util/update-grub_lib.in | 12 ++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc9cb4432..fd9328bf2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-05-06 Robert Millan + + * util/update-grub_lib.in (make_system_path_relative_to_its_root): + Do not print a trailing slash (therefore, the root directory is an + empty string). + (convert_system_path_to_grub_path): Do not remove trailing slash + from make_system_path_relative_to_its_root() output. + + * util/i386/pc/grub-install.in: Add trailing slash to output from + make_system_path_relative_to_its_root(). + 2008-05-06 Robert Millan * util/grub-fstest.c (grub_refresh): Call `fflush (stdout)'. This diff --git a/util/i386/pc/grub-install.in b/util/i386/pc/grub-install.in index 34e98e9f4..60da57a76 100644 --- a/util/i386/pc/grub-install.in +++ b/util/i386/pc/grub-install.in @@ -229,7 +229,7 @@ devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_ma # _chain is often useful modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain" -$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1 +$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}`/ $modules || exit 1 # Now perform the installation. $grub_setup --directory=${grubdir} --device-map=${device_map} \ diff --git a/util/update-grub_lib.in b/util/update-grub_lib.in index 628714084..2d7092b1b 100644 --- a/util/update-grub_lib.in +++ b/util/update-grub_lib.in @@ -61,7 +61,14 @@ make_system_path_relative_to_its_root () dir=$parent done - echo $path | sed -e "s,^$dir,/,g" -e "s,//,/,g" + # This function never prints trailing slashes (so that its output can be + # appended a slash unconditionally). Each slash in $dir is considered a + # preceding slash, and therefore the root directory is an empty string. + if [ "$dir" = "/" ] ; then + dir="" + fi + + echo $path | sed -e "s,^$dir,,g" } convert_system_path_to_grub_path () @@ -86,9 +93,6 @@ convert_system_path_to_grub_path () return 1 fi - # remove any trailing slash, even if that slash is everything we have - relative_path=`echo ${relative_path} | sed -e "s,/*$,,g"` - echo ${drive}${relative_path} }