X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=handlers%2Fmysql;h=20905d56232010748dabff102602b25e273e3db0;hb=c3cc44d1b216ca01dffb35396d7f9c7ff12ea3f0;hp=cb7010435a3dbfd98a7e0eaf834a0b297e5e1207;hpb=1427b5f6183302df984e8d58121001efc29d3837;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/handlers/mysql b/handlers/mysql index cb70104..20905d5 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -115,19 +115,21 @@ fi # specify the password on the command line. defaultsfile="" + if [ "$dbusername" != "" -a "$dbpassword" != "" ] then if [ $usevserver ] then - home=`$VSERVER $vsname exec getent passwd "root" | awk -F: '{print $6}'` - home="$vroot$home" - debug "Home set to: $home" + vhome=`$VSERVER $vsname exec getent passwd "root" | awk -F: '{print $6}'` + home="$vroot$vhome" else home=`getent passwd "root" | awk -F: '{print $6}'` - debug "Home set to: $home" fi + [ -d $home ] || fatal "Can't find root's home directory ($home)." + mycnf="$home/.my.cnf" + if [ -f $mycnf ] then # rename temporarily @@ -135,27 +137,37 @@ then debug "mv $mycnf $tmpcnf" mv $mycnf $tmpcnf fi + oldmask=`umask` umask 077 cat > $mycnf <