3
0
Fork 0
forked from mirrors/nixpkgs

* Handle symlinks such as /dev/disk/by-label/bla. Previously

Grub installation barfed.

svn path=/nixpkgs/trunk/; revision=12877
This commit is contained in:
Eelco Dolstra 2008-09-18 09:43:31 +00:00
parent 74669a825c
commit 35cc272d07
2 changed files with 48 additions and 1 deletions

View file

@ -17,16 +17,26 @@ stdenv.mkDerivation {
sha256 = "12akcbp1a31pxzsxm01scgir0fqkk8qqqwhs44vzgs2chzzigyvd";
};
patches = [
# Properly handle the case of symlinks such as
# /dev/disk/by-label/bla. The symlink resolution code in
# grub-install isn't smart enough.
./symlink.patch
];
# Autoconf/automake required for the splashimage patch.
buildInputs = [autoconf automake];
preConfigure = ''
prePatch = ''
unpackFile $gentooPatches
rm patch/400_all_grub-0.97-reiser4-20050808-gentoo.patch
for i in patch/*.patch; do
echo "applying patch $i"
patch -p1 < $i || patch -p0 < $i
done
'';
preConfigure = ''
autoreconf
'';
}

View file

@ -0,0 +1,37 @@
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