1 |
|
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 |
|
12 | dir="$(dirname "$(dirname "$0")")"
|
13 | cli="$dir"/bin/npm-cli.js
|
14 | tmp="$cli".tmp
|
15 |
|
16 | node="$1"
|
17 | if [ "x$node" = "x" ]; then
|
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"
|
26 | chmod ogu+x $cli
|