mirror of
https://github.com/tj/n.git
synced 2024-11-21 18:48:57 +01:00
Activating install
This commit is contained in:
parent
0161070687
commit
0fa203814c
@ -32,6 +32,8 @@ or
|
||||
`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.
|
||||
|
||||
Activated nodes are then installed to the prefix _/usr/local_.
|
||||
|
||||
To alter where `n` operates simply export __N_PREFIX__ to whatever you prefer.
|
||||
|
||||
## License
|
||||
|
30
bin/n
30
bin/n
@ -115,17 +115,27 @@ install_node() {
|
||||
# already active
|
||||
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
|
||||
local dir="node-v$version"
|
||||
cd $PREFIX/n \
|
||||
&& $GET "http://nodejs.org/dist/node-v$version.tar.gz" \
|
||||
> "$dir.tar.gz" \
|
||||
&& tar -zxf "$dir.tar.gz" \
|
||||
&& cd $dir \
|
||||
&& ./configure --prefix $VERSIONS_DIR/$version\
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
&& cleanup $version
|
||||
else
|
||||
local dir="node-v$version"
|
||||
cd $PREFIX/n \
|
||||
&& $GET "http://nodejs.org/dist/node-v$version.tar.gz" \
|
||||
> "$dir.tar.gz" \
|
||||
&& tar -zxf "$dir.tar.gz" \
|
||||
&& cd $dir \
|
||||
&& ./configure --prefix $VERSIONS_DIR/$version\
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
&& cleanup $version \
|
||||
&& n $version
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user