forked from HyperVM/hypervm-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-dev.sh
executable file
·153 lines (139 loc) · 4.96 KB
/
deploy-dev.sh
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/sh
# HyperVM, Server Virtualization GUI for OpenVZ and Xen
#
# Copyright (C) 2000-2009 LxLabs
# Copyright (C) 2009-2014 LxCenter
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# author: Ángel Guzmán Maeso <[email protected]>
#
# Install and deploy a develoment version on a local enviroment
#
# Version 0.6 Added local [ Krzysztof Taraszka <[email protected]> ]
# Version 0.5 Added legacy & NG [ Krzysztof Taraszka <[email protected]> ]
# Version 0.4 Added which, zip and unzip as requirement [ Danny Terweij <[email protected]> ]
# Version 0.3 Added perl-ExtUtils-MakeMaker as requirement to install_GIT [ Danny Terweij <[email protected]> ]
# Version 0.2 Changed git version [ Danny Terweij <[email protected]> ]
# Version 0.1 Initial release [ Ángel Guzmán Maeso <[email protected]> ]
#
HYPERVM_PATH='/usr/local/lxlabs'
usage(){
echo "Usage: $0 [BRANCH] [-h]"
echo 'BRANCH: master, legacy, dev or local'
echo 'h: shows this help.'
exit 1
}
install_GIT()
{
# Redhat based
if [ -f /etc/redhat-release ] ; then
# Install git with curl and expat support to enable support on github cloning
yum install -y gcc gettext-devel expat-devel curl-devel zlib-devel openssl-devel perl-ExtUtils-MakeMaker
# Debian based
elif [ -f /etc/debian_version ] ; then
# No tested
apt-get install gcc
fi
# @todo Try to get the lastest version from some site. LATEST file?
GIT_VERSION='1.8.3.4'
echo "Downloading and compiling GIT ${GIT_VERSION}"
wget http://git-core.googlecode.com/files/git-${GIT_VERSION}.tar.gz
tar xvfz git-*.tar.gz; cd git-*;
./configure --prefix=/usr --with-curl --with-expat
make all
make install
echo 'Cleaning GIT files.'
cd ..; rm -rf git-*
}
require_root()
{
if [ `/usr/bin/id -u` -ne 0 ]; then
echo 'Please, run this script as root.'
usage
fi
}
require_requirements()
{
#
# without them, it will compile each run git and does not create/unzip the development files.
#
yum -y install which zip unzip
}
require_root
require_requirements
echo 'Installing HyperVM-NG development version.'
if which git >/dev/null; then
echo 'GIT support detected.'
else
echo 'No GIT support detected. Installing GIT.'
install_GIT
fi
case $1 in
master )
# Clone from GitHub the last version using git transport (no http or https)
echo "Installing branch hypervm/master"
mkdir -p ${HYPERVM_PATH}
git clone https://github.com/hypervm-ng/hypervm-ng.git ${HYPERVM_PATH}
cd ${HYPERVM_PATH}
git checkout master
cd ${HYPERVM_PATH}/hypervm-install
sh ./make-distribution.sh
cd ${HYPERVM_PATH}/hypervm
sh ./make-development.sh
printf "Done.\nInstall HyperVM-NG:\ncd ${HYPERVM_PATH}/hypervm-install/hypervm-linux/\nsh hypervm-install-[master|slave].sh with args\n"
;;
legacy )
# Clone from GitHub the last version using git transport (no http or https)
echo "Installing branch hypervm/legacy"
mkdir -p ${HYPERVM_PATH}
git clone https://github.com/hypervm-ng/hypervm-ng.git ${HYPERVM_PATH}
cd ${HYPERVM_PATH}
git checkout legacy
cd ${HYPERVM_PATH}/hypervm-install
sh ./make-distribution.sh
cd ${HYPERVM_PATH}/hypervm
sh ./make-development.sh
printf "Done.\nInstall HyperVM-NG:\ncd ${HYPERVM_PATH}/hypervm-install/hypervm-linux/\nsh hypervm-install-[master|slave].sh with args\n"
;;
dev )
# Clone from GitHub the last version using git transport (no http or https)
echo "Installing branch hypervm/dev"
git clone https://github.com/hypervm-ng/hypervm-ng.git ${HYPERVM_PATH}
cd ${HYPERVM_PATH}
git checkout dev -f
cd ${HYPERVM_PATH}/hypervm-install
sh ./make-distribution.sh
cd ${HYPERVM_PATH}/hypervm
sh ./make-development.sh
printf "Done.\nInstall HyperVM-NG:\ncd ${HYPERVM_PATH}/hypervm-install/hypervm-linux/\nsh hypervm-install-[master|slave].sh with args\n"
;;
local )
# Clone from GitHub the last version using git transport (no http or https)
echo "Installing local branch of hypervm"
if [ ! -f ${HYPERVM_PATH}/.git ]
then
touch ${HYPERVM_PATH}/.git
fi
cd hypervm-install
sh ./make-distribution.sh
cd ..//hypervm
sh ./make-development.sh
cp hypervm-current.zip ${HYPERVM_PATH}/hypervm
printf "Done.\nInstall HyperVM-NG:\ncd hypervm-install/hypervm-linux/\nsh hypervm-install-[master|slave].sh with args\n"
;;
* )
usage
return 1 ;;
esac