2009-11-04 Felix Zielcke <fzielcke@z-51.de>
* util//grub-mkconfig_lib.in (bindir): New variable. (grub_mkrelpath): Likewise. Properly set path variable. Use ${grub_mkrelpath} instead of calling it directly. 2009-11-02 Felix Zielcke <fzielcke@z-51.de> * util/probe.c (probe): Make the file path relative to its root. Change a info message to use the GRUB path. Enable again the check if we can read the file with GRUB facilities. 2009-11-01 Felix Zielcke <fzielcke@z-51.de> * util/grub-mkrelpath.c: New file. * conf/common.rmk (bin_UTILITIES): Add grub-mkrelpath. (grub_mkrelpath_SOURCES): New variable. * include/grub/util/misc.h: New function prototype. * util/misc.c (make_system_path_relative_to_its_root): New function. * util/grub-mkconfig_lib.in (make_system_path_relative_to_its_root): Use grub-mkrelpath.
This commit is contained in:
parent
c926e1d585
commit
50ceeb7cb5
7 changed files with 219 additions and 50 deletions
|
@ -20,10 +20,12 @@ prefix=@prefix@
|
|||
exec_prefix=@exec_prefix@
|
||||
datarootdir=@datarootdir@
|
||||
datadir=@datadir@
|
||||
bindir=@bindir@
|
||||
sbindir=@sbindir@
|
||||
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
|
||||
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
||||
|
||||
grub_warn ()
|
||||
{
|
||||
|
@ -32,49 +34,7 @@ grub_warn ()
|
|||
|
||||
make_system_path_relative_to_its_root ()
|
||||
{
|
||||
path=$1
|
||||
# abort if file doesn't exist
|
||||
if test -e $path ; then : ;else
|
||||
return 1
|
||||
fi
|
||||
|
||||
# canonicalize
|
||||
if path=`readlink -f $path` ; then : ; else
|
||||
return 1
|
||||
fi
|
||||
|
||||
# if not a directory, climb up to the directory containing it
|
||||
if test -d $path ; then
|
||||
dir=$path
|
||||
else
|
||||
dir=`echo $path | sed -e "s,/[^/]*$,,g"`
|
||||
fi
|
||||
|
||||
num=`stat -c %d $dir`
|
||||
|
||||
# this loop sets $dir to the root directory of the filesystem we're inspecting
|
||||
while : ; do
|
||||
parent=`readlink -f $dir/..`
|
||||
if [ "x`stat -c %d $parent`" = "x$num" ] ; then : ; else
|
||||
# $parent is another filesystem; we found it.
|
||||
break
|
||||
fi
|
||||
if [ "x$dir" = "x/" ] ; then
|
||||
# / is our root.
|
||||
break
|
||||
fi
|
||||
dir=$parent
|
||||
done
|
||||
|
||||
# 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
|
||||
|
||||
# XXX: This fails if $dir contains ','.
|
||||
path=`echo "$path" | sed -e "s,^$dir,,g"` || return 1
|
||||
path="`${grub_mkrelpath} $1`"
|
||||
|
||||
case "`uname 2>/dev/null`" in
|
||||
CYGWIN*)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue