about summary refs log tree commit diff
path: root/pkgs/tools/text/gnugrep/default.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-06 22:05:55 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-06 22:05:55 +0200
commita1d9c563891beb5ec26ea3293cac9da9f4628b51 (patch)
tree7d7025fc588687e13e706eb6e9eb0a892b674dc4 /pkgs/tools/text/gnugrep/default.nix
parent00c0c2a7852605b70b7e11c7bf8c032b03255ed0 (diff)
gnugrep: Fix bootstrap-tools reference
Diffstat (limited to 'pkgs/tools/text/gnugrep/default.nix')
-rw-r--r--pkgs/tools/text/gnugrep/default.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/tools/text/gnugrep/default.nix b/pkgs/tools/text/gnugrep/default.nix
index e64f363c0390e..8be986e0cbb7c 100644
--- a/pkgs/tools/text/gnugrep/default.nix
+++ b/pkgs/tools/text/gnugrep/default.nix
@@ -22,6 +22,18 @@ stdenv.mkDerivation {
     export MKDIR_P="mkdir -p"
   '';
 
+  # Fix reference to sh in bootstrap-tools, and invoke grep via
+  # absolute path rather than looking at argv[0].
+  postInstall =
+    ''
+      rm $out/bin/egrep $out/bin/fgrep
+      echo "#! /bin/sh" > $out/bin/egrep
+      echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
+      echo "#! /bin/sh" > $out/bin/fgrep
+      echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
+      chmod +x $out/bin/egrep $out/bin/fgrep
+    '';
+
   meta = {
     homepage = http://www.gnu.org/software/grep/;
     description = "GNU implementation of the Unix grep command";