1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-27 16:11:58 +00:00
nixpkgs/pkgs/tools/misc/grub/symlink.patch
Eelco Dolstra 35cc272d07 * Handle symlinks such as /dev/disk/by-label/bla. Previously
Grub installation barfed.

svn path=/nixpkgs/trunk/; revision=12877
2008-09-18 09:43:31 +00:00

38 lines
1 KiB
Diff

diff -rc grub-0.97-orig/util/grub-install.in grub-0.97/util/grub-install.in
*** grub-0.97-orig/util/grub-install.in 2008-09-18 11:32:13.000000000 +0200
--- grub-0.97/util/grub-install.in 2008-09-18 11:36:40.000000000 +0200
***************
*** 194,217 ****
# 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
--- 194,200 ----
# Usage: resolve_symlink file
# Find the real file/device that file points at
resolve_symlink () {
! readlink -f $1
}
# Usage: find_device file