Skip to content
This repository
Newer
Older
100755 27 lines (21 sloc) 0.665 kb
d87712ee »
2012-07-13 Add a script to point the shebang at something else
1 #!/bin/bash
2
3 # Change the cli shebang to point at the specified node
4 # Useful for when the program is moved around after install.
5 # Also used by the default 'make install' in node to point
6 # npm at the newly installed node, rather than the first one
7 # in the PATH, which would be the default otherwise.
8
9 # bash /path/to/npm/scripts/relocate.sh $nodepath
10 # If $nodepath is blank, then it'll use /usr/bin/env
11
0519ad86 »
2012-07-13 Fix relocate script properly
12 dir="$(dirname "$(dirname "$0")")"
d87712ee »
2012-07-13 Add a script to point the shebang at something else
13 cli="$dir"/bin/npm-cli.js
14 tmp="$cli".tmp
15
16 node="$1"
0519ad86 »
2012-07-13 Fix relocate script properly
17 if [ "x$node" = "x" ]; then
d87712ee »
2012-07-13 Add a script to point the shebang at something else
18 node="/usr/bin/env node"
19 fi
20 node="#!$node"
21
22 sed -e 1d "$cli" > "$tmp"
23 echo "$node" > "$cli"
24 cat "$tmp" >> "$cli"
25 rm "$tmp"
0519ad86 »
2012-07-13 Fix relocate script properly
26 chmod ogu+x $cli
Something went wrong with that request. Please try again.