buildNodePackage: Handle all node/coffee shebang possibilities

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-07-18 15:44:48 -04:00
parent 7f9e83f8cc
commit b73021a475

View File

@ -42,8 +42,14 @@ stdenv.mkDerivation ({
mv node_modules $out/node_modules/${requireName} mv node_modules $out/node_modules/${requireName}
if [ -d "$out/node_modules/.bin" ]; then if [ -d "$out/node_modules/.bin" ]; then
ln -sv node_modules/.bin $out/bin ln -sv node_modules/.bin $out/bin
node=`type -p node`
coffee=`type -p coffee || true`
find -L $out/node_modules/.bin/* -type f -print0 | \ find -L $out/node_modules/.bin/* -type f -print0 | \
xargs -0 sed --follow-symlinks -i 's@#!/usr/bin/env node@#!${nodejs}/bin/node@' xargs -0 sed --follow-symlinks -i \
-e 's@#!/usr/bin/env node@#!'"$node"'@' \
-e 's@#!/usr/bin/env coffee@#!'"$coffee"'@' \
-e 's@#!/.*/node@#!'"$node"'@' \
-e 's@#!/.*/coffee@#!'"$coffee"'@'
fi fi
if [ -e "$out/node_modules/${requireName}/man" ]; then if [ -e "$out/node_modules/${requireName}/man" ]; then
mkdir $out/share mkdir $out/share