-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInstall_NodeJS
More file actions
executable file
·77 lines (52 loc) · 1.21 KB
/
Install_NodeJS
File metadata and controls
executable file
·77 lines (52 loc) · 1.21 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# Set defaults
prefix="${PREFIX:=${HOME}/installed}"
tag="${TAG:=v8.2.0}"
set -e
function usage()
{
cat << EOF
Usage: $0 [[[-]-prefix[=]| ]PREFIX] [TAG]
Install nodeJS from the github source.
---------------- OPTIONS -------------------------
-prefix PREFIX Set the installation prefix directory.
Don't include a trailing '/'. The default prefix
is $prefix
TAG pick a particular git tag of the source to install.
The default tag is $tag
EOF
exit 1
}
while [ -n "$1" ] ; do
case "$1" in
-h*|--h*)
usage
;;
-prefix|--prefix)
shift 1
[ -z "$1"] && usage
prefix="$1"
;;
-prefix=*|--prefix=*)
prefix="${1##*-prefix=}"
;;
*)
tag="$1"
;;
esac
shift
done
set -o pipefail
echo "prefix=$prefix"
echo "nodeJS github tag=$tag"
set -x
mkdir BUILD_nodejs
cd BUILD_nodejs
path=nodejs/node
wget -O - https://github.com/$path/tarball/$tag | tar -xz
cd nodejs-node*
./configure --prefix=$prefix
make -j$(nproc)
make install
set +x
echo "SUCCESSFULLY installed nodeJS $tag in prefix=$prefix"