Set grants for user sipwise before running scripts

Otherwise we don't seem to be able to bootstrap the installation.
Needs review.

From: Michael Prokop <mprokop@sipwise.com>
0.1
Michael Prokop 13 years ago
parent 438572f505
commit b03f266aeb

@ -5,6 +5,16 @@ hostname="$(hostname)"
/etc/init.d/mysql start || true
. /etc/mysql/sipwise.cnf
if [ -z "${SIPWISE_DB_PASSWORD}" ] ; then
echo 'Error: SIPWISE_DB_PASSWORD is unset (using /etc/mysql/sipwise.cnf).' >&2
exit 1
fi
if ! mysql -e "GRANT ALL PRIVILEGES ON *.* TO sipwise@localhost IDENTIFIED BY '${SIPWISE_DB_PASSWORD}' WITH GRANT OPTION;" ; then
echo 'Error: grants for user sipwise on localhost could not be applied.' >&2
exit 1
fi
if ! mysql -usipwise -p${SIPWISE_DB_PASSWORD} -e 'use ngcp;' 2>/dev/null ; then
mysql -usipwise -p${SIPWISE_DB_PASSWORD} < /usr/share/ngcp-db-schema/db_scripts/init/0005_create_ngcp.up
fi

Loading…
Cancel
Save