From 3f8550802ac7ea9f52aa9743bd69722e09c2ec91 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Thu, 12 Nov 2015 13:43:02 +0100 Subject: [PATCH] trying a different install script for mysql.sh : skipping if already installed --- install/mysql.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/install/mysql.sh b/install/mysql.sh index c8506277..77f7193f 100755 --- a/install/mysql.sh +++ b/install/mysql.sh @@ -45,11 +45,23 @@ # # Those values are used to set the username/passwords... +MYSQL_CONFIG="/etc/alternc/my.cnf" +MYSQL_MAIL_CONFIG="/etc/alternc/my_mail.cnf" + +# We start by checking if an already configured mysql works, in that case we DON'T TOUCH IT +if [ -f "$MYSQL_CONFIG" ] +then + mysql --defaults-file="$MYSQL_CONFIG" -e "SELECT COUNT(*) FROM membres" >/dev/null + if [ "$?" = "0" ] + then + echo "MySQL already setup, schema & grant install skipped" + return + fi +fi + # The grant all is the most important right needed in this script. echo "Granting users..." -MYSQL_CONFIG="/etc/alternc/my.cnf" -MYSQL_MAIL_CONFIG="/etc/alternc/my_mail.cnf" . /etc/alternc/local.sh # the purpose of this "grant" is to make sure that the generated my.cnf works