X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=grub-functions.sh;h=e68bb4259a7b014f97133cb89d0b0edd751e11ba;hb=3404916f2b3bab88e5d8bcd8ef0a339f6d980e85;hp=feb2481a9e15e0a22892fc157096625a4a269d36;hpb=a57315045176d50b56a1e3452e19a67682d3bd1a;p=kernel-cn.git diff --git a/grub-functions.sh b/grub-functions.sh index feb2481..e68bb42 100755 --- a/grub-functions.sh +++ b/grub-functions.sh @@ -242,6 +242,29 @@ convert_default () { 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"