#################################################################
##### 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"
[[ -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
AWK=$(which awk)
GREP=$(which grep)
DIRNAME=`dirname $0`
+HERE=$(realpath $(dirname $0))
function usage(){
echo -e "Usage: $0 OPTIONS [{openvim_version}]"
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 }