From a06801226f0dc9c07dd2f221c7fc3ebbb3658066 Mon Sep 17 00:00:00 2001 From: Dan Lidral-Porter Date: Thu, 30 Jun 2011 16:19:36 -0700 Subject: [PATCH] Create a symlink to every alias's node binary. When an alias is created, a directory named _bin is also created in the alias directory, and a symlink pointing to the target's node binary is created within that directory. This allows you to, for example, make that alias's node the default node binary for all users, by placing a symlink to the alias's symlink in, say, /usr/bin. This is most handy for ensuring that node scripts which must be run as root, such as init scripts that change their uids, will have access to a node binary. --- nvm.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvm.sh b/nvm.sh index 39c950e..15232ba 100644 --- a/nvm.sh +++ b/nvm.sh @@ -197,6 +197,7 @@ nvm() fi if [ ! "$3" ]; then rm -f $NVM_DIR/alias/$2 + rm -rf $NVM_DIR/alias/$2_bin echo "$2 -> *poof*" return fi @@ -210,6 +211,9 @@ nvm() echo "$2 -> $3 (-> $VERSION)" echo "! WARNING: Moving target. Aliases to implicit versions may change without warning." else + rm -rf $NVM_DIR/alias/$2_bin 2>/dev/null + mkdir -p $NVM_DIR/alias/$2_bin + ln -s $NVM_DIR/$3/bin/node $NVM_DIR/alias/$2_bin/node echo "$2 -> $3" fi ;;