X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=handlers%2Fmysql.in;h=6e894fee967d19a864e034e6bc5ba0fb48a25fda;hp=fe1e7832f32ee43c090cf5e17d6e985e040f8376;hb=64edfccf7684d9c080e734b25fa9361f0190afec;hpb=668f8ddf2a95fa975661782346a26bf98589f655 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 <