|
| 1 | +#!/bin/sh |
| 2 | +# HyperVM, Server Virtualization GUI for OpenVZ and Xen |
| 3 | +# |
| 4 | +# Copyright (C) 2000-2009 LxLabs |
| 5 | +# Copyright (C) 2009-2014 LxCenter |
| 6 | +# |
| 7 | +# This program is free software: you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU Affero General Public License as |
| 9 | +# published by the Free Software Foundation, either version 3 of the |
| 10 | +# License, or (at your option) any later version. |
| 11 | +# |
| 12 | +# This program is distributed in the hope that it will be useful, |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +# GNU Affero General Public License for more details. |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU Affero General Public License |
| 18 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | +# |
| 20 | +# author: Ángel Guzmán Maeso <[email protected]> |
| 21 | +# |
| 22 | +# Install and deploy a develoment version on a local enviroment |
| 23 | +# |
| 24 | +# Version 0.4 Added which, zip and unzip as requirement [ Danny Terweij <[email protected]> ] |
| 25 | +# Version 0.3 Added perl-ExtUtils-MakeMaker as requirement to install_GIT [ Danny Terweij <[email protected]> ] |
| 26 | +# Version 0.2 Changed git version [ Danny Terweij <[email protected]> ] |
| 27 | +# Version 0.1 Initial release [ Ángel Guzmán Maeso <[email protected]> ] |
| 28 | +# |
| 29 | +HYPERVM_PATH='/usr/local/lxlabs' |
| 30 | + |
| 31 | +usage(){ |
| 32 | + echo "Usage: $0 [BRANCH] [-h]" |
| 33 | + echo 'BRANCH: master or dev' |
| 34 | + echo 'h: shows this help.' |
| 35 | + exit 1 |
| 36 | +} |
| 37 | + |
| 38 | +install_GIT() |
| 39 | +{ |
| 40 | + # Redhat based |
| 41 | + if [ -f /etc/redhat-release ] ; then |
| 42 | + # Install git with curl and expat support to enable support on github cloning |
| 43 | + yum install -y gcc gettext-devel expat-devel curl-devel zlib-devel openssl-devel perl-ExtUtils-MakeMaker |
| 44 | + # Debian based |
| 45 | + elif [ -f /etc/debian_version ] ; then |
| 46 | + # No tested |
| 47 | + apt-get install gcc |
| 48 | + fi |
| 49 | + |
| 50 | + # @todo Try to get the lastest version from some site. LATEST file? |
| 51 | + GIT_VERSION='1.8.3.4' |
| 52 | + |
| 53 | + echo "Downloading and compiling GIT ${GIT_VERSION}" |
| 54 | + wget http://git-core.googlecode.com/files/git-${GIT_VERSION}.tar.gz |
| 55 | + tar xvfz git-*.tar.gz; cd git-*; |
| 56 | + ./configure --prefix=/usr --with-curl --with-expat |
| 57 | + make all |
| 58 | + make install |
| 59 | + |
| 60 | + echo 'Cleaning GIT files.' |
| 61 | + cd ..; rm -rf git-* |
| 62 | +} |
| 63 | + |
| 64 | +require_root() |
| 65 | +{ |
| 66 | + if [ `/usr/bin/id -u` -ne 0 ]; then |
| 67 | + echo 'Please, run this script as root.' |
| 68 | + usage |
| 69 | + fi |
| 70 | +} |
| 71 | + |
| 72 | +require_requirements() |
| 73 | +{ |
| 74 | + # |
| 75 | + # without them, it will compile each run git and does not create/unzip the development files. |
| 76 | + # |
| 77 | + yum -y install which zip unzip |
| 78 | +} |
| 79 | + |
| 80 | + |
| 81 | +require_root |
| 82 | + |
| 83 | +require_requirements |
| 84 | + |
| 85 | +echo 'Installing HyperVM development version.' |
| 86 | + |
| 87 | +if which git >/dev/null; then |
| 88 | + echo 'GIT support detected.' |
| 89 | +else |
| 90 | + echo 'No GIT support detected. Installing GIT.' |
| 91 | + install_GIT |
| 92 | +fi |
| 93 | + |
| 94 | +case $1 in |
| 95 | + master ) |
| 96 | + # Clone from GitHub the last version using git transport (no http or https) |
| 97 | + echo "Installing branch hypervm/master" |
| 98 | + mkdir -p ${HYPERVM_PATH} |
| 99 | + git clone git://github.com/lxcenter/hypervm.git ${HYPERVM_PATH} |
| 100 | + cd ${HYPERVM_PATH} |
| 101 | + git checkout master |
| 102 | + cd ${HYPERVM_PATH}/hypervm-install |
| 103 | + sh ./make-distribution.sh |
| 104 | + cd ${HYPERVM_PATH}/hypervm |
| 105 | + sh ./make-development.sh |
| 106 | + printf "Done.\nInstall HyperVM:\ncd ${HYPERVM_PATH}/hypervm-install/hypervm-linux/\nsh hypervm-install-[master|slave].sh with args\n" |
| 107 | + ;; |
| 108 | + dev ) |
| 109 | + # Clone from GitHub the last version using git transport (no http or https) |
| 110 | + echo "Installing branch hypervm/dev" |
| 111 | + git clone git://github.com/lxcenter/hypervm.git ${HYPERVM_PATH} |
| 112 | + cd ${HYPERVM_PATH} |
| 113 | + git checkout dev -f |
| 114 | + cd ${HYPERVM_PATH}/hypervm-install |
| 115 | + sh ./make-distribution.sh |
| 116 | + cd ${HYPERVM_PATH}/hypervm |
| 117 | + sh ./make-development.sh |
| 118 | + printf "Done.\nInstall HyperVM:\ncd ${HYPERVM_PATH}/hypervm-install/hypervm-linux/\nsh hypervm-install-[master|slave].sh with args\n" |
| 119 | + ;; |
| 120 | + * ) |
| 121 | + usage |
| 122 | + return 1 ;; |
| 123 | +esac |
0 commit comments