0
0
mirror of https://github.com/tj/n.git synced 2024-11-25 07:39:21 +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

30
bin/n
View File

@ -115,17 +115,27 @@ 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
local dir="node-v$version" else
cd $PREFIX/n \ local dir="node-v$version"
&& $GET "http://nodejs.org/dist/node-v$version.tar.gz" \ cd $PREFIX/n \
> "$dir.tar.gz" \ && $GET "http://nodejs.org/dist/node-v$version.tar.gz" \
&& tar -zxf "$dir.tar.gz" \ > "$dir.tar.gz" \
&& cd $dir \ && tar -zxf "$dir.tar.gz" \
&& ./configure --prefix $VERSIONS_DIR/$version\ && cd $dir \
&& make install \ && ./configure --prefix $VERSIONS_DIR/$version\
&& cd .. \ && make install \
&& cleanup $version && cd .. \
&& cleanup $version \
&& n $version
fi
} }
# #