-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart.sh
More file actions
40 lines (36 loc) · 874 Bytes
/
start.sh
File metadata and controls
40 lines (36 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
NODE_SOURCE_DIR='build/node'
NODE_INSTALL_DIR=$NODE_SOURCE_DIR'/installed'
# Plumbing...
exist_directory() {
[ -d $1 ];
}
clone_node_from_github() {
git clone https://github.com/joyent/node.git $NODE_SOURCE_DIR
}
install_node() {
mkdir $NODE_INSTALL_DIR
PREFIX=$PWD/$NODE_INSTALL_DIR
pushd $NODE_SOURCE_DIR
./configure --prefix=$PREFIX
make install
popd
}
is_command_in_path() {
command -v $1 > /dev/null;
}
add_node_to_path() {
export PATH=$PWD/$NODE_INSTALL_DIR/bin:${PATH}
}
install_npm() {
curl http://npmjs.org/install.sh | clean=yes sh
}
# [ Start! ]
# Checking Node.js
exist_directory $NODE_SOURCE_DIR || clone_node_from_github
exist_directory $NODE_INSTALL_DIR || install_node
is_command_in_path 'node' || add_node_to_path
node --version
#Checking NPM
is_command_in_path 'npm' || install_npm
npm --version