From 246783bbd358ea427f90ba45a6ba18329f354460 Mon Sep 17 00:00:00 2001 From: micah Date: Tue, 27 Dec 2005 17:37:44 +0000 Subject: [PATCH] r219@um: micah | 2005-12-27 10:32:24 -0500 Defaults file is now set correctly for vservers dbhost is now added to the .my.cnf git-svn-id: http://code.autistici.org/svn/backupninja/trunk@280 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/mysql | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/handlers/mysql b/handlers/mysql index cb70104..408399d 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 <