X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=blobdiff_plain;f=scripts%2Finstall-openmano.sh;h=3789992fae4ed74cd29f229c646119342d5f76f5;hp=54896c8665fe8a3cc84be159f27f799863f9e3cc;hb=c5293def02d95ed4ee086dd8842437b76ec05c4e;hpb=e04c71531149b9e362a06cab4dd7554680559996 diff --git a/scripts/install-openmano.sh b/scripts/install-openmano.sh index 54896c86..3789992f 100755 --- a/scripts/install-openmano.sh +++ b/scripts/install-openmano.sh @@ -1,7 +1,7 @@ #!/bin/bash ## -# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U. +# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U. # This file is part of openmano # All Rights Reserved. # @@ -81,8 +81,8 @@ function ask_user(){ } GIT_URL=https://osm.etsi.org/gerrit/osm/RO.git -GIT_OVIM_URL=https://osm.etsi.org/gerrit/osm/openvim.git -GIT_OSMIM_URL=https://osm.etsi.org/gerrit/osm/IM.git +export GIT_OVIM_URL=https://osm.etsi.org/gerrit/osm/openvim.git +export GIT_OSMIM_URL=https://osm.etsi.org/gerrit/osm/IM.git DBUSER="root" DBPASSWD="" DBPASSWD_PARAM="" @@ -117,7 +117,7 @@ while getopts ":u:p:b:hiq-:" o; do ;; -) [ "${OPTARG}" == "help" ] && usage && exit 0 - [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue + [ "${OPTARG}" == "develop" ] && export DEVELOP="y" && continue [ "${OPTARG}" == "forcedb" ] && DB_FORCE_UPDATE="${DB_FORCE_UPDATE}--forcedb" && continue [ "${OPTARG}" == "updatedb" ] && DB_FORCE_UPDATE="${DB_FORCE_UPDATE}--updatedb" && continue [ "${OPTARG}" == "force" ] && FORCE="y" && continue @@ -200,6 +200,7 @@ else #[ "$_DISTRO" != "Ubuntu" -a "$_DISTRO" != "CentOS" -a "$_DISTRO" != "Red" echo "Cancelled" && exit 1 fi +export _DISTRO="$_DISTRO" #check if installed as a service INSTALL_AS_A_SERVICE="" [[ "$_DISTRO" == "Ubuntu" ]] && [[ ${_RELEASE%%.*} == 16 ]] && [[ -z $DEVELOP ]] && INSTALL_AS_A_SERVICE="y" @@ -207,14 +208,14 @@ INSTALL_AS_A_SERVICE="" # Next operations require knowing BASEFOLDER if [[ -z "$NOCLONE" ]]; then if [[ -n "$INSTALL_AS_A_SERVICE" ]] ; then - BASEFOLDER=__openmano__${RANDOM} + export BASEFOLDER=__openmano__${RANDOM} else - BASEFOLDER="${PWD}/openmano" + export BASEFOLDER="${PWD}/openmano" fi [[ -n "$FORCE" ]] && rm -rf $BASEFOLDER #make idempotent else HERE=$(dirname $(readlink -f ${BASH_SOURCE[0]})) - BASEFOLDER=$(dirname $HERE) + export BASEFOLDER=$(dirname $HERE) fi if [[ -z "$NO_PACKAGES" ]] @@ -224,7 +225,7 @@ then "##### UPDATE REPOSITORIES #####\n"\ "#################################################################" [ "$_DISTRO" == "Ubuntu" ] && apt-get update -y && - add-apt-repository -y cloud-archive:pike && apt-get update -y + add-apt-repository -y cloud-archive:queens && apt-get update -y [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && yum check-update -y [ "$_DISTRO" == "CentOS" ] && yum install -y epel-release @@ -245,23 +246,23 @@ then "#################################################################" [ "$_DISTRO" == "Ubuntu" ] && install_packages "python-yaml python-bottle python-mysqldb python-jsonschema "\ "python-paramiko python-argcomplete python-requests python-logutils libxml2-dev libxslt-dev python-dev "\ - "python-pip python-crypto" + "python-pip python-crypto python-networkx" [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "PyYAML MySQL-python python-jsonschema "\ "python-paramiko python-argcomplete python-requests python-logutils libxslt-devel libxml2-devel python-devel "\ - "python-pip python-crypto" + "python-pip python-crypto python-networkx" # The only way to install python-bottle on Centos7 is with easy_install or pip [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && easy_install -U bottle # required for vmware connector TODO move that to separete opt in install script - pip install pip==9.0.3 || exit 1 # --upgrade pip install pip 10 that does not work - pip install pyvcloud==19.1.1 || exit 1 - pip install progressbar || exit 1 - pip install prettytable || exit 1 - pip install pyvmomi || exit 1 + pip2 install pip==9.0.3 || exit 1 # --upgrade pip install pip 10 that does not work + pip2 install pyvcloud==19.1.1 || exit 1 + pip2 install progressbar || exit 1 + pip2 install prettytable || exit 1 + pip2 install pyvmomi || exit 1 # required for OpenNebula connector - pip install untangle || exit 1 - pip install -e git+https://github.com/python-oca/python-oca#egg=oca || exit 1 + pip2 install untangle || exit 1 + pip2 install -e git+https://github.com/python-oca/python-oca#egg=oca || exit 1 # required for AWS connector [ "$_DISTRO" == "Ubuntu" ] && install_packages "python-boto" @@ -311,71 +312,17 @@ echo -e "\n"\ "#################################################################\n"\ "##### INSTALLING OSM-IM LIBRARY #####\n"\ "#################################################################" -su $SUDO_USER -c "git -C ${BASEFOLDER} clone ${GIT_OSMIM_URL} IM" || - ! echo "Error cannot clone from '${GIT_OSMIM_URL}'" >&2 || exit 1 -if [[ -n $COMMIT_ID ]] ; then - echo -e "Installing osm-IM from refspec: $COMMIT_ID" - su $SUDO_USER -c "git -C ${BASEFOLDER}/IM checkout $COMMIT_ID" || - ! echo "Error cannot checkout '$COMMIT_ID' from '${GIT_OSMIM_URL}'" >&2 || exit 1 -elif [[ -z $DEVELOP ]]; then - LATEST_STABLE_TAG=`git -C "${BASEFOLDER}/IM" tag -l "v[0-9]*" | sort -V | tail -n1` - echo -e "Installing osm-IM from refspec: tags/${LATEST_STABLE_TAG}" - su $SUDO_USER -c "git -C ${BASEFOLDER}/IM checkout tags/${LATEST_STABLE_TAG}" || - ! echo "Error cannot checkout 'tags/${LATEST_STABLE_TAG}' from '${GIT_OSMIM_URL}'" >&2 || exit 1 -else - echo -e "Installing osm-IM from refspec: master" -fi - -# Install debian dependencies before setup.py -if [[ -z "$NO_PACKAGES" ]] -then - [ "$_DISTRO" == "Ubuntu" ] && install_packages "tox debhelper python-bitarray python-lxml python-six" - # TODO check packages for CentOS and RedHat - [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "tox debhelper python-bitarray python-lxml python-six" - pip install --upgrade stdeb pyangbind || exit 1 -fi -su $SUDO_USER -c "make -C ${BASEFOLDER}/IM all" -dpkg -i ${BASEFOLDER}/IM/deb_dist/python-osm-im*.deb ${BASEFOLDER}/IM/pyangbind/deb_dist/*.deb \ - ${BASEFOLDER}/IM/pyang/deb_dist/*.deb -rm -rf "${BASEFOLDER}/IM" -OSM_IM_PATH=`python -c 'import osm_im; print osm_im.__path__[0]'` || - ! echo "ERROR installing python-osm-im library!!!" >&2 || exit 1 - + ${BASEFOLDER}/scripts/install-osm-im.sh + OSM_IM_PATH=`python -c 'import osm_im; print osm_im.__path__[0]'` || + ! echo "ERROR installing python-osm-im library!!!" >&2 || exit 1 echo -e "\n"\ "#################################################################\n"\ "##### INSTALLING OVIM LIBRARY #####\n"\ "#################################################################" -su $SUDO_USER -c "git -C ${BASEFOLDER} clone ${GIT_OVIM_URL} openvim" || - ! echo "Error cannot clone from '${GIT_OVIM_URL}'" || exit 1 -if [[ -n $COMMIT_ID ]] ; then - echo -e "Installing lib_osm_openvim from refspec: $COMMIT_ID" - su $SUDO_USER -c "git -C ${BASEFOLDER}/openvim checkout $COMMIT_ID" || - ! echo "Error cannot checkout '$COMMIT_ID' from '${GIT_OVIM_URL}'" || exit 1 -elif [[ -z $DEVELOP ]]; then - LATEST_STABLE_TAG=`git -C "${BASEFOLDER}/openvim" tag -l "v[0-9]*" | sort -V | tail -n1` - echo -e "Installing lib_osm_openvim from refspec: tags/${LATEST_STABLE_TAG}" - su $SUDO_USER -c "git -C ${BASEFOLDER}/openvim checkout tags/${LATEST_STABLE_TAG}" || - ! echo "Error cannot checkout 'tags/${LATEST_STABLE_TAG}' from '${GIT_OVIM_URL}'" || exit 1 -else - echo -e "Installing lib_osm_openvim from refspec: master" -fi - -# Install debian dependencies before setup.py -if [[ -z "$NO_PACKAGES" ]] -then - [ "$_DISTRO" == "Ubuntu" ] && install_packages \ - "libmysqlclient-dev python-cffi python-packaging python-pkgconfig python-pycparser libssl-dev libffi-dev" - # TODO check if that is the name in CentOS and RedHat - [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages \ - "libmysqlclient-dev python-cffi python-packaging python-pkgconfig python-pycparser libssl-dev libffi-dev" - pip install --upgrade stdeb setuptools-version-command || exit 1 -fi -su $SUDO_USER -c "make -C ${BASEFOLDER}/openvim lite" -dpkg -i ${BASEFOLDER}/openvim/.build/python-lib-osm-openvim*.deb -rm -rf "${BASEFOLDER}/openvim" -OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` || - ! echo "ERROR installing python-lib-osm-openvim library!!!" >&2 || exit 1 + ${BASEFOLDER}/scripts/install-lib-osm-openvim.sh + OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` || + ! echo "ERROR installing python-lib-osm-openvim library!!!" >&2 || exit 1 if [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] then