From: mirabal Date: Wed, 26 Apr 2017 10:44:14 +0000 (+0200) Subject: Fix bug installing openvim and db generation X-Git-Tag: v2.0.1~20 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F1702%2F11;p=osm%2Fopenvim.git Fix bug installing openvim and db generation Change-Id: Ia60430c1d372a8915321295752b5f3b2e372001b Signed-off-by: mirabal --- diff --git a/database_utils/install-db-server.sh b/database_utils/install-db-server.sh index d0a3637..7f5c9eb 100755 --- a/database_utils/install-db-server.sh +++ b/database_utils/install-db-server.sh @@ -156,7 +156,7 @@ echo ' function db_exists(){ # (db_name, credential_file) # check credentials mysqlshow --defaults-extra-file="$2" >/dev/null || exit 1 - RESULT=`mysqlshow --defaults-extra-file="$2" | grep -v Wildcard | grep -o $1` + RESULT=`mysqlshow --defaults-extra-file="$2" | grep -v Wildcard | grep -w $1` if [ "$RESULT" == "$1" ]; then # echo " DB $1 exists" return 0 diff --git a/scripts/initopenvim.sh b/scripts/initopenvim.sh index 85dda5b..2fb3439 100755 --- a/scripts/initopenvim.sh +++ b/scripts/initopenvim.sh @@ -116,11 +116,11 @@ then echo "deleting deployed vm" ${DIRvim}/openvim vm-delete -f | grep -q deleted && sleep 10 #give some time to get virtual machines deleted echo "Stopping openvim${screen_name_param}${openvim_param}" - $DIRNAME/service-openvim.sh stop${screen_name_param}${openvim_param} + $DIRNAME/service-openvim stop${screen_name_param}${openvim_param} echo "Initializing databases $db_name" $DIRvim/database_utils/init_vim_db.sh -u vim -p vimpw -d $db_name echo "Starting openvim${screen_name_param}${openvim_param}" - $DIRNAME/service-openvim.sh start${screen_name_param}${openvim_param} + $DIRNAME/service-openvim start${screen_name_param}${openvim_param} elif [[ $action == delete-all ]] then diff --git a/scripts/install-openvim-service.sh b/scripts/install-openvim-service.sh index 4cf393d..b862cc1 100755 --- a/scripts/install-openvim-service.sh +++ b/scripts/install-openvim-service.sh @@ -134,8 +134,8 @@ mkdir -p /opt/openvim/logs ln -s -v /opt/openvim/openvimd.cfg /etc/default/openvimd.cfg || echo "warning cannot create link '/etc/default/openvimd.cfg'" ln -s -v /opt/openvim/logs /var/log/openvim || echo "warning cannot create link '/var/log/openvim'" ln -s -v /opt/openvim/openvim /usr/bin/openvim -ln -s -v /opt/openvim/scripts/service-openvim.sh /usr/sbin/service-openvim -ln -s -v /opt/openvim/scripts/openvim-report.sh /usr/bin/openvim-report +ln -s -v /opt/openvim/scripts/service-openvim /usr/sbin/service-openvim +ln -s -v /opt/openvim/scripts/openvim-report /usr/bin/openvim-report ln -s -v /opt/openvim/scripts/initopenvim.sh /usr/bin/initopenvim ln -s -v /opt/openvim/openflow /usr/bin/openflow @@ -148,7 +148,7 @@ Description=openvim server [Service] User=${USER_OWNER} -ExecStart=/opt/openvim/openvimd.py -c /opt/openvim/openvimd.cfg --log-file=/opt/openvim/logs/openvim.log +ExecStart=/opt/openvim/openvimd -c /opt/openvim/osm_openvim/openvimd.cfg --log-file=/opt/openvim/logs/openvim.log Restart=always [Install] diff --git a/scripts/install-openvim.sh b/scripts/install-openvim.sh index fa79436..5f0867f 100755 --- a/scripts/install-openvim.sh +++ b/scripts/install-openvim.sh @@ -62,7 +62,7 @@ function install_packages(){ } function db_exists() { - RESULT=`mysqlshow --defaults-extra-file="$2" | grep -v Wildcard | grep -o $1` + RESULT=`mysqlshow --defaults-extra-file="$2" | grep -v Wildcard | grep -w $1` if [ "$RESULT" == "$1" ]; then echo " DB $1 exists" return 0 @@ -185,7 +185,7 @@ if [[ -z "$NOCLONE" ]]; then fi [[ -n "$FORCE" ]] && rm -rf $OPENVIM_BASEFOLDER #make idempotent else - HERE=$(realpath $(dirname $0)) + HERE=$(dirname $(readlink -f ${BASH_SOURCE[0]})) OPENVIM_BASEFOLDER=$(dirname $HERE) fi @@ -257,17 +257,6 @@ then done fi - -if [ -z "$NO_DB" ]; then - if [ -n "$QUIET_MODE" ]; then - DB_QUIET='-q' - fi - - echo "!!!! install-db-server.sh: ${OPENVIM_BASEFOLDER}/scripts/install-db-server.sh -u $DBUSER $DBPASSWD_PARAM -n vim_db $DB_QUIET" - ${OPENVIM_BASEFOLDER}/scripts/install-db-server.sh -u $DBUSER $DBPASSWD_PARAM $DB_QUIET || exit 1 -fi - - if [[ -z "$NO_PACKAGES" ]] then @@ -311,9 +300,18 @@ if [[ -z $NOCLONE ]]; then su $SUDO_USER -c "git clone ${GIT_URL} ${OPENVIM_BASEFOLDER}" su $SUDO_USER -c "cp ${OPENVIM_BASEFOLDER}/.gitignore-common ${OPENVIM_BASEFOLDER}/.gitignore" - [[ -z $DEVELOP ]] && su $SUDO_USER -c "git -C ${OPENVIM_BASEFOLDER} checkout tags/v1.0.2" + [[ -z $DEVELOP ]] && su $SUDO_USER -c "git -C ${OPENVIM_BASEFOLDER} checkout v2.0" fi +DB_QUIET='' +if [ -z "$NO_DB" ]; then + if [ -n "$QUIET_MODE" ]; then + DB_QUIET='-q' + fi + + echo "!!!! install-db-server.sh: ${OPENVIM_BASEFOLDER}/database_utils/install-db-server.sh -U $DBUSER $DBPASSWD_PARAM $DB_QUIET" + ${OPENVIM_BASEFOLDER}/database_utils/install-db-server.sh -U $DBUSER $DBPASSWD_PARAM $DB_QUIET || exit 1 +fi if [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] @@ -363,10 +361,10 @@ then su $SUDO_USER -c 'rm -f ${HOME}/bin/get_dhcp_lease.sh' su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/openvim' "'${HOME}/bin/openvim' su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/openflow' "'${HOME}/bin/openflow' - su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/service-openvim.sh' "'${HOME}/bin/service-openvim' - su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/initopenvim.sh' "'${HOME}/bin/initopenvim' - su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/service-floodlight.sh' "'${HOME}/bin/service-floodlight' - su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/service-opendaylight.sh' "'${HOME}/bin/service-opendaylight' + su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/service-openvim' "'${HOME}/bin/service-openvim' + su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/initopenvim' "'${HOME}/bin/initopenvim' + su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/service-floodlight' "'${HOME}/bin/service-floodlight' + su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/service-opendaylight' "'${HOME}/bin/service-opendaylight' su $SUDO_USER -c "ln -s '${OPENVIM_BASEFOLDER}/scripts/get_dhcp_lease.sh' "'${HOME}/bin/get_dhcp_lease.sh' #insert /home//bin in the PATH