From 57697f9ef826d2ba5490daee8ff55004d0635c7f Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 21 Apr 2017 12:49:08 +0200 Subject: [PATCH] Fix bug when installing vim_db based on ovim.py version Change-Id: I21dfd6e4524d6d7e52902674278e739b5079d360 Signed-off-by: garciadeblas --- database_utils/install-db-server.sh | 6 +++--- database_utils/migrate_vim_db.sh | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/database_utils/install-db-server.sh b/database_utils/install-db-server.sh index 4d816a5..5a9b9ab 100755 --- a/database_utils/install-db-server.sh +++ b/database_utils/install-db-server.sh @@ -23,7 +23,7 @@ function _create_db(){ ################################################################# ##### CREATE DATABASE ##### #################################################################' - echo -e "\nCreating temporary file form MYSQL installation and initialization" + echo -e "\nCreating temporary file for MYSQL installation and initialization" TEMPFILE="$(mktemp -q --tmpdir "installopenvim.XXXXXX")" trap 'rm -f "$TEMPFILE"' EXIT chmod 0600 "$TEMPFILE" @@ -35,8 +35,8 @@ function _create_db(){ [[ -n $QUIET_MODE ]] && DBDELETEPARAM="-f" mysqladmin --defaults-extra-file=$TEMPFILE -s drop ${DB_NAME} $DBDELETEPARAM || ! echo "Could not delete ${DB_NAME} database" || exit 1 mysqladmin --defaults-extra-file=$TEMPFILE -s create ${DB_NAME} || ! echo "1 Error creating ${DB_NAME} database" || exit 1 - echo "CREATE USER $DB_USER@'localhost' IDENTIFIED BY '$DB_PASS';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "2 Failed while creating user vim at database" - echo "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO $DB_USER@'localhost';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "3 Failed while creating user vim at database" || exit 1 + echo "CREATE USER $DB_USER@'localhost' IDENTIFIED BY '$DB_PASS';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "2 Failed while creating user ${DB_USER}" + echo "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO $DB_USER@'localhost';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "3 Failed while granting privileges to user ${DB_USER} at database ${DB_NAME}" || exit 1 echo " Database '${DB_NAME}' created, user $DB_USER password '$DB_PASS'" else echo "Database exists. Use option '--forcedb' to force the deletion of the existing one" && exit 1 diff --git a/database_utils/migrate_vim_db.sh b/database_utils/migrate_vim_db.sh index 6318769..a2c116c 100755 --- a/database_utils/migrate_vim_db.sh +++ b/database_utils/migrate_vim_db.sh @@ -36,6 +36,7 @@ MYSQL=$(which mysql) AWK=$(which awk) GREP=$(which grep) DIRNAME=`dirname $0` +HERE=$(realpath $(dirname $0)) function usage(){ echo -e "Usage: $0 OPTIONS [{openvim_version}]" @@ -93,7 +94,7 @@ shift $((OPTIND-1)) OPENVIM_VER="$1" if [ -z "$OPENVIM_VER" ] then - OVIM_PATH=`python -c 'import osm_openvim; print osm_openvim.__path__[0]' 2> /dev/null` + OVIM_PATH=$(dirname $HERE) OPENVIM_VER=`python ${OVIM_PATH}/ovim.py -v 2> /dev/null` OPENVIM_VER=${OPENVIM_VER%%-r*} OPENVIM_VER=${OPENVIM_VER##*version } -- 2.25.1