-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.sh
More file actions
executable file
·59 lines (39 loc) · 903 Bytes
/
Copy pathnode.sh
File metadata and controls
executable file
·59 lines (39 loc) · 903 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# node.sh [base directory] [version]
#
# Retrieves and builds "version". Base directory (i.e., /usr/local) is where
# any installed files will be rooted. Defaults to current directory.
#
VERSION="0.6.8"
BASEDIR=$(pwd)
if [ $# -gt 0 ] ; then
BASEDIR=$1
fi
if [ $# -gt 1 ] ; then
VERSION=$2
fi
FILENAME=node-v$VERSION.tar.gz
mkdir -p $BASEDIR/src
pushd $BASEDIR/src
echo "=== DOWNLOADING $FILENAME ==="
curl -O http://nodejs.org/dist/v$VERSION/$FILENAME
echo "=== UNPACKING $FILENAME ==="
tar xvzf $FILENAME
pushd $(basename $FILENAME .tar.gz)
echo "=== CONFIGURING $FILENAME ==="
./configure --prefix=$BASEDIR
if [ $? -eq 0 ] ; then
echo "=== BUILDING $FILENAME ==="
make
fi
if [ $? -eq 0 ] ; then
echo "=== INSTALLING $FILENAME ==="
make install
fi
if [ $? -eq 0 ] ; then
echo "=== INSTALLING npm ==="
curl http://npmjs.org/install.sh | sh
fi
popd
popd