0
0
mirror of https://github.com/tj/n.git synced 2024-11-28 21:22:03 +01:00

Activating install

This commit is contained in:
Tj Holowaychuk 2011-01-05 07:40:17 -08:00
parent 0161070687
commit 0fa203814c
2 changed files with 22 additions and 10 deletions

View File

@ -32,6 +32,8 @@ or
`n` by default installs node to _/usr/local/n/versions_, from `n` by default installs node to _/usr/local/n/versions_, from
which it can see what you have currently installed, and activate previously installed versions of node when `n <version>` is invoked again. which it can see what you have currently installed, and activate previously installed versions of node when `n <version>` is invoked again.
Activated nodes are then installed to the prefix _/usr/local_.
To alter where `n` operates simply export __N_PREFIX__ to whatever you prefer. To alter where `n` operates simply export __N_PREFIX__ to whatever you prefer.
## License ## License

12
bin/n
View File

@ -115,7 +115,15 @@ install_node() {
# already active # already active
test "$version" = "$installed" && return test "$version" = "$installed" && return
# installed
local dir=$VERSIONS_DIR/$version
local prefix=/usr/local
if test -d $dir; then
cd $dir \
&& cp -fr $dir/include/node $prefix/include \
&& cp -f $dir/bin/node $prefix/bin/node
# install # install
else
local dir="node-v$version" local dir="node-v$version"
cd $PREFIX/n \ cd $PREFIX/n \
&& $GET "http://nodejs.org/dist/node-v$version.tar.gz" \ && $GET "http://nodejs.org/dist/node-v$version.tar.gz" \
@ -125,7 +133,9 @@ install_node() {
&& ./configure --prefix $VERSIONS_DIR/$version\ && ./configure --prefix $VERSIONS_DIR/$version\
&& make install \ && make install \
&& cd .. \ && cd .. \
&& cleanup $version && cleanup $version \
&& n $version
fi
} }
# #