From 64edfccf7684d9c080e734b25fa9361f0190afec Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 29 Mar 2009 22:19:20 -0300 Subject: [PATCH] fixes for mysql handler for mysqld inside a vserver --- handlers/mysql.in | 55 ++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/handlers/mysql.in b/handlers/mysql.in index fe1e783..6e894fe 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -88,8 +88,7 @@ if [ "$dbusername" != "" -a "$dbpassword" != "" ] then if [ $usevserver = yes ] then - vhome=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` - home="$vroot$vhome" + home=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` else home=`getent passwd "root" | @AWK@ -F: '{print $6}'` fi @@ -97,18 +96,25 @@ then [ -d $home ] || fatal "Can't find root's home directory ($home)." mycnf="$home/.my.cnf" - - if [ -f $mycnf ] + + if [ $usevserver = yes ] + then + workcnf="$vroot$mycnf" + else + workcnf="$mycnf" + fi + + if [ -f $workcnf ] then - # rename temporarily - tmpcnf="$home/my.cnf.disable" - debug "mv $mycnf $tmpcnf" - mv $mycnf $tmpcnf + # rename temporarily + tmpcnf="$workcnf.disable" + debug "mv $workcnf $tmpcnf" + mv $workcnf $tmpcnf fi oldmask=`umask` umask 077 - cat > $mycnf < $workcnf <