forked from cloudify-cosmo/cloudify-nodecellar-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-app.sh
More file actions
executable file
·45 lines (33 loc) · 1.13 KB
/
Copy pathinstall-app.sh
File metadata and controls
executable file
·45 lines (33 loc) · 1.13 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
#!/bin/bash
function info(){ builtin echo [INFO] [$(basename $0)] $@; }
function error(){ builtin echo [ERROR] [$(basename $0)] $@; }
#. ${CLOUDIFY_LOGGING}
#. ${CLOUDIFY_FILE_SERVER}
TEMP_DIR="/tmp"
info "Changing directory to ${TEMP_DIR}"
cd ${TEMP_DIR} || exit $?
YUM_CMD=$(which yum)
APT_GET_CMD=$(which apt-get)
info "Downloading application sources to ${TEMP_DIR}"
if [ -f nodecellar ]; then
info "Application sources already exists, skipping"
else
if [[ ! -z $YUM_CMD ]]; then
sudo yum -y install git-core || exit $?
elif [[ ! -z $APT_GET_CMD ]]; then
sudo apt-get -qq install git || exit $?
else
error "error can't install package git"
exit 1;
fi
info "cloning application from git url ${git_url}"
git clone ${git_url} || exit $?
cd nodecellar || exit $?
if [[ ! -z $git_branch ]]; then
info "checking out branch ${git_branch}"
git checkout ${git_branch} || exit $?
fi
info "Installing application modules using npm"
/tmp/nodejs/nodejs/bin/npm install --silent || exit $?
fi
info "Finished installing application ${app_name}"