From d65fa0c058b6a2e91126e1634aafd130807f58bd Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 5 Jan 2010 13:09:38 +0100 Subject: [PATCH] Cherry-picked "fixes for mysql handler for mysqld inside a vserver" This commit (64edfccf7684d9c080e734b25fa9361f0190afec) was wrongly committed to the debian branch. Conflicts: handlers/mysql.in --- handlers/mysql.in | 119 ++++++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/handlers/mysql.in b/handlers/mysql.in index 0aa3abb..3b7423f 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -88,29 +88,35 @@ defaultsfile="" if [ "$dbusername" != "" -a "$dbpassword" != "" ] then - if [ $usevserver = yes ] - then - vhome=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` - home="$vroot$vhome" - else - home=`getent passwd "root" | @AWK@ -F: '{print $6}'` - fi + if [ $usevserver = yes ] + then + home=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` + else + home=`getent passwd "root" | @AWK@ -F: '{print $6}'` + fi - [ -d $home ] || fatal "Can't find root's home directory ($home)." + [ -d $home ] || fatal "Can't find root's home directory ($home)." + + mycnf="$home/.my.cnf" - mycnf="$home/.my.cnf" - - if [ -f $mycnf ] - then - # rename temporarily - tmpcnf="$home/my.cnf.disable" - debug "mv $mycnf $tmpcnf" - mv $mycnf $tmpcnf - fi + if [ $usevserver = yes ] + then + workcnf="$vroot$mycnf" + else + workcnf="$mycnf" + fi - oldmask=`umask` - umask 077 - cat > $mycnf < $workcnf <