X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=handlers%2Fmysql.in;h=3b7423f21fa32ae72ea8f07e8a27a24ac0b54c4f;hb=d65fa0c058b6a2e91126e1634aafd130807f58bd;hp=88ffb1a798fa8d9eec8e1d8587aa439fd4b5768c;hpb=78884142e7cdaaf3e1f5571b1f28d2ea5a520b30;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/handlers/mysql.in b/handlers/mysql.in index 88ffb1a..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 <