1#!/usr/bin/env 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 12dir="$(dirname "$(dirname "$0")")" 13cli="$dir"/bin/npm-cli.js 14tmp="$cli".tmp 15 16node="$1" 17if [ "x$node" = "x" ]; then 18 node="/usr/bin/env node" 19fi 20node="#!$node" 21 22sed -e 1d "$cli" > "$tmp" 23echo "$node" > "$cli" 24cat "$tmp" >> "$cli" 25rm "$tmp" 26chmod ogu+x $cli 27