aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap.sh
blob: 802b7f1a8ee9dfaa7d1ba47cf9e112689847dbe2 (plain) (blame)
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
40
41
42
43
44
45
46
47
#! /bin/sh

###########################
# start config

PREFIX=`pwd`/usr/
NODE_VERSION=0.3.5

# end config 
###########################

export PATH=${PREFIX}/bin:${PATH}

## Download Helper 
# $1 - url
# $2 - destdir
download() {
    mkdir -p ${PREFIX}/src
    
    if [ ! -f ${2} ]; then
	echo "!! saving source to $1"
        curl ${1} | tar -x -z -C ${PREFIX}/src
    fi
}

if [ ! -f ${PREFIX}/bin/node ]; then
    # fetch and compile nodejs
    download http://nodejs.org/dist/node-v${NODE_VERSION}.tar.gz ${PREFIX}/src/node-v${NODE_VERSION}

    cd ${PREFIX}/src/node-v${NODE_VERSION} 
    ./configure --prefix=${PREFIX}
    make install
    cd ${PREFIX}/..
else 
   echo "!! node already installed"
fi

if [ ! -f ${PREFIX}/bin/npm ];then
    # fetch and compile npm
    curl http://npmjs.org/install.sh |  sh
else 
   echo "!! npm already installed"

fi

# load development code and compile dependencies
npm link src/nodejs/