+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>
* stage2/fsys_reiserfs.c (read_tree_node): Fixed a typo; only
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
# Find block device on which the file resides.
find_device () {
exit 1
fi
- # 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
+ tmp_fname=`resolve_symlink $tmp_fname`
- # 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"
}
# Check for INSTALL_DEVICE.
case "$install_device" in
/dev/*)
+ install_device=`resolve_symlink "$install_device"`
install_drive=`convert "$install_device"`
# I don't know why, but some shells wouldn't die if exit is
# called in a function.