From b608be4c32a0bc8bc5f989e5fd3583b76c954328 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 19 Nov 2013 18:50:51 +0530 Subject: [PATCH] If MySQL Is Installed Dont Set Wrong Password In ~/.my.cnf --- usr/local/sbin/easyengine | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/usr/local/sbin/easyengine b/usr/local/sbin/easyengine index 5bfe2ce4..04de69e3 100755 --- a/usr/local/sbin/easyengine +++ b/usr/local/sbin/easyengine @@ -250,13 +250,20 @@ INSTALLPMA() MYSQLINSTALLTWEAKS() { - # Setting Up MySQL Password - MYSQLAUTOPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) - debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQLAUTOPASS" - debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQLAUTOPASS" + # MySQL Password Only Set If MySQL Is Not Installed + # If MySQL Is Installed Dont Set Wrong Password In ~/.my.cnf + dpkg -l | grep mysql-server - # Generate ~/.my.cnf - echo -e "[client]\nuser=root\npassword=$MYSQLAUTOPASS" > ~/.my.cnf + if [ $? -ne 0 ] + then + # Setting Up MySQL Password + MYSQLAUTOPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) + debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQLAUTOPASS" + debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQLAUTOPASS" + + # Generate ~/.my.cnf + echo -e "[client]\nuser=root\npassword=$MYSQLAUTOPASS" > ~/.my.cnf + fi } INSTALLMYSQL()