git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 1fb68173 authored by Bob Mottram's avatar Bob Mottram

Check it database already exists

parent 7f2c446f
......@@ -65,17 +65,23 @@ fi
# create the database
if [ $MYSQL_ROOT_PASS ]; then
# create a database
echo "create database ${APP};
# check database doesn't exist
RESULT=$(mysqlshow --user=root --password="$MYSQL_ROOT_PASS" gnusocial | grep -v Wildcard | grep -o gnusocial)
if [ "$RESULT" != "gnusocial" ]; then
# create a database
echo "create database ${APP};
CREATE USER '${APP}admin'@'localhost' IDENTIFIED BY '$ADMIN_PASS';
GRANT ALL PRIVILEGES ON ${APP}.* TO '${APP}admin'@'localhost';
quit" > $SQL_FILE
chmod 600 $SQL_FILE
mysql -u root --password="$MYSQL_ROOT_PASS" < $SQL_FILE
if [ ! "$?" = "0" ]; then
echo $"Unable to create database for ${APP}"
chmod 600 $SQL_FILE
mysql -u root --password="$MYSQL_ROOT_PASS" < $SQL_FILE
if [ ! "$?" = "0" ]; then
echo $"Unable to create database for ${APP}"
fi
rm $SQL_FILE
else
echo 'gnusocial database already exists'
fi
rm $SQL_FILE
fi
rm -rf $SCRDIR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment