forked from cloudify-cosmo/cloudify-nodecellar-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-nodejs.sh
More file actions
executable file
·50 lines (37 loc) · 1.22 KB
/
Copy pathinstall-nodejs.sh
File metadata and controls
executable file
·50 lines (37 loc) · 1.22 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
#!/bin/bash
function info(){ builtin echo [INFO] [$(basename $0)] $@; }
function error(){ builtin echo [ERROR] [$(basename $0)] $@; }
#. ${CLOUDIFY_LOGGING}
#. ${CLOUDIFY_FILE_SERVER}
TEMP_DIR="/tmp"
NODEJS_ROOT=${TEMP_DIR}/nodejs
NODEJS_TARBALL=node-v0.10.26-linux-x64.tar.gz
BLUEPRINT_PATH=blueprints/${CLOUDIFY_BLUEPRINT_ID}
if [ ! -f ${NODEJS_ROOT} ]; then
mkdir -p ${NODEJS_ROOT} || exit $?
fi
YUM_CMD=$(which yum)
APT_GET_CMD=$(which apt-get)
info "Changing directory to ${NODEJS_ROOT}"
cd ${NODEJS_ROOT} || exit $?
info "Downloading nodejs to ${NODEJS_ROOT}"
if [ -f ${NODEJS_TARBALL} ]; then
info "Nodejs tarball already exists, skipping"
else
if [[ ! -z $YUM_CMD ]]; then
sudo yum -y install curl || exit $?
elif [[ ! -z $APT_GET_CMD ]]; then
sudo apt-get -qq install curl || exit $?
else
error "can't install package git"
exit 1;
fi
curl -O http://nodejs.org/dist/v0.10.26/${NODEJS_TARBALL} || exit $?
fi
if [ ! -d mongodb ]; then
info "Untaring nodejs"
tar -zxvf node-v0.10.26-linux-x64.tar.gz || exit $?
info "Moving nodejs distro to ${NODEJS_ROOT}/nodejs"
mv node-v0.10.26-linux-x64 nodejs || exit $?
fi
info "Finished installing nodejs"