added new function to resolve_symlink to grub-install.in
moved code from find_device to this function install_device is now run through the new function
This commit is contained in:
parent
7c7f8f73ea
commit
fc2a2dc3d7
2 changed files with 32 additions and 13 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2003-08-13 Jason Thomas <jason@intology.com.au>
|
||||||
|
|
||||||
|
* util/grub-install.in (resolve_symlink): New function to resolve symlinks
|
||||||
|
(find_device): moved symlink code to new function
|
||||||
|
Before we convert the install_device we attempt to resolve it if its a
|
||||||
|
symlink using the new function
|
||||||
|
|
||||||
2003-06-17 Jochen Hoenicke <jochen@gnu.org>
|
2003-06-17 Jochen Hoenicke <jochen@gnu.org>
|
||||||
|
|
||||||
* stage2/fsys_reiserfs.c (read_tree_node): Fixed a typo; only
|
* stage2/fsys_reiserfs.c (read_tree_node): Fixed a typo; only
|
||||||
|
|
|
@ -181,6 +181,29 @@ convert () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: resolve_symlink file
|
||||||
|
# Find the real file/device that file points at
|
||||||
|
resolve_symlink () {
|
||||||
|
tmp_fname=$1
|
||||||
|
# Resolve symlinks
|
||||||
|
while test -L $tmp_fname; do
|
||||||
|
tmp_new_fname=`ls -al $tmp_fname | sed -n 's%.*-> \(.*\)%\1%p'`
|
||||||
|
if test -z "$tmp_new_fname"; then
|
||||||
|
echo "Unrecognized ls output" 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Convert relative symlinks
|
||||||
|
case $tmp_new_fname in
|
||||||
|
/*) tmp_fname="$tmp_new_fname"
|
||||||
|
;;
|
||||||
|
*) tmp_fname="`echo $tmp_fname | sed 's%/[^/]*$%%'`/$tmp_new_fname"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
echo "$tmp_fname"
|
||||||
|
}
|
||||||
|
|
||||||
# Usage: find_device file
|
# Usage: find_device file
|
||||||
# Find block device on which the file resides.
|
# Find block device on which the file resides.
|
||||||
find_device () {
|
find_device () {
|
||||||
|
@ -193,20 +216,8 @@ find_device () {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Resolve symlinks
|
tmp_fname=`resolve_symlink $tmp_fname`
|
||||||
while test -L $tmp_fname; do
|
|
||||||
tmp_new_fname=`ls -al $tmp_fname | sed -n 's%.*-> \(.*\)%\1%p'`
|
|
||||||
if test -z "$tmp_new_fname"; then
|
|
||||||
echo "Unrecognized ls output" 2>&1
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Convert relative symlinks
|
|
||||||
case $tmp_new_fname in
|
|
||||||
/*) tmp_fname="$tmp_new_fname" ;;
|
|
||||||
*) tmp_fname="`echo $tmp_fname | sed 's%/[^/]*$%%'`/$tmp_new_fname" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
echo "$tmp_fname"
|
echo "$tmp_fname"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,6 +349,7 @@ fi
|
||||||
# Check for INSTALL_DEVICE.
|
# Check for INSTALL_DEVICE.
|
||||||
case "$install_device" in
|
case "$install_device" in
|
||||||
/dev/*)
|
/dev/*)
|
||||||
|
install_device=`resolve_symlink "$install_device"`
|
||||||
install_drive=`convert "$install_device"`
|
install_drive=`convert "$install_device"`
|
||||||
# I don't know why, but some shells wouldn't die if exit is
|
# I don't know why, but some shells wouldn't die if exit is
|
||||||
# called in a function.
|
# called in a function.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue