X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=handlers%2Fmysql.in;h=f3230ad3ede61e1c2278c9a4ad1f63757aa3b3e0;hp=0aa3abbc9f4c5fb2d926d9f7ef41d5d6db8cdf6f;hb=a53e8a531a78465d449751864b19a13d4f993797;hpb=f4ab3148f175f8ac415b01fea61d14a80f4de969 diff --git a/handlers/mysql.in b/handlers/mysql.in index 0aa3abb..f3230ad 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -90,27 +90,33 @@ 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 [ -d $home ] || fatal "Can't find root's home directory ($home)." - + mycnf="$home/.my.cnf" - if [ -f $mycnf ] + if [ $usevserver = yes ] then - # rename temporarily - tmpcnf="$home/my.cnf.disable" - debug "mv $mycnf $tmpcnf" - mv $mycnf $tmpcnf + workcnf="$vroot$mycnf" + else + workcnf="$mycnf" fi + if [ -f $workcnf ] + then + # rename temporarily + tmpcnf="$workcnf.disable" + debug "mv $workcnf $tmpcnf" + mv $workcnf $tmpcnf + fi + oldmask=`umask` umask 077 - cat > $mycnf < $workcnf <