echo $device
}
+find_device_nonresolved ()
+{
+ mount_point=$1
+
+ # Autodetect current root device
+ device=
+ if [ -f /etc/fstab ] ; then
+ while read DEV MNT FOO; do
+ if `echo "$DEV" | grep -q "^#"`; then
+ continue
+ fi
+ if [ "$MNT" = "$mount_point" ]; then
+ device="$DEV";
+ fi
+ done < /etc/fstab
+ fi
+
+ if [ -n "$device" ] ; then
+ case "$device" in
+ LABEL=* | UUID=*)
+ device=`findfs $device`
+ ;;
+ esac
+ fi
+
+ echo $device
+}
+
find_root_device ()
{
device=$(find_device "/")
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"
+}
+
## Configuration Options
# directory's to look for the grub installation and the menu file
grub_dirs="/boot/grub /boot/boot/grub"