summary refs log tree commit diff
path: root/pkgs/tools/misc/grub/symlink.patch
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2008-09-18 09:43:31 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2008-09-18 09:43:31 +0000
commit35cc272d0742cdc5838bfed3f86ee73386f30f7f (patch)
tree5aaedc312871fa993ec88b19fc8134c105c2224f /pkgs/tools/misc/grub/symlink.patch
parent74669a825ca3bfb8b36e7f3d02148da8075e7c1e (diff)
downloadnixpkgs-35cc272d0742cdc5838bfed3f86ee73386f30f7f.tar
nixpkgs-35cc272d0742cdc5838bfed3f86ee73386f30f7f.tar.gz
nixpkgs-35cc272d0742cdc5838bfed3f86ee73386f30f7f.tar.bz2
nixpkgs-35cc272d0742cdc5838bfed3f86ee73386f30f7f.tar.lz
nixpkgs-35cc272d0742cdc5838bfed3f86ee73386f30f7f.tar.xz
nixpkgs-35cc272d0742cdc5838bfed3f86ee73386f30f7f.tar.zst
nixpkgs-35cc272d0742cdc5838bfed3f86ee73386f30f7f.zip
* Handle symlinks such as /dev/disk/by-label/bla. Previously
  Grub installation barfed.

svn path=/nixpkgs/trunk/; revision=12877
Diffstat (limited to 'pkgs/tools/misc/grub/symlink.patch')
-rw-r--r--pkgs/tools/misc/grub/symlink.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/pkgs/tools/misc/grub/symlink.patch b/pkgs/tools/misc/grub/symlink.patch
new file mode 100644
index 00000000000..ac38be04618
--- /dev/null
+++ b/pkgs/tools/misc/grub/symlink.patch
@@ -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