aboutsummaryrefslogtreecommitdiff
path: root/handlers/mysql.in
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-06-24 16:53:58 +0200
committerintrigeri <intrigeri@boum.org>2010-06-24 16:53:58 +0200
commit40155781065eb7254eb9fc9c48bd85b0b8ace4c0 (patch)
treeaaaf8d87e5f205289675c4bc38530dd66ea766aa /handlers/mysql.in
parent9179c59b50ddf1a8e11817924df7f589a76500b4 (diff)
downloadbackupninja-40155781065eb7254eb9fc9c48bd85b0b8ace4c0.tar.gz
backupninja-40155781065eb7254eb9fc9c48bd85b0b8ace4c0.tar.bz2
Fix code logic to make dbusername/dbpassword actually usable (Closes Redmine bug #2264)
Diffstat (limited to 'handlers/mysql.in')
-rw-r--r--handlers/mysql.in15
1 files changed, 8 insertions, 7 deletions
diff --git a/handlers/mysql.in b/handlers/mysql.in
index 68d5197..0282046 100644
--- a/handlers/mysql.in
+++ b/handlers/mysql.in
@@ -86,7 +86,7 @@ fi
defaultsfile=""
-if [ "$dbusername" != "" -a "$dbpassword" != "" ]
+if [ -n "$dbusername" -a -n "$dbpassword" ]
then
if [ $usevserver = yes ]
then
@@ -140,13 +140,10 @@ password="$dbpassword"
EOF
umask $oldmask
defaultsfile="--defaults-extra-file=$mycnf"
-fi
-# if a user is not set, use $configfile, otherwise use $mycnf
-if [ "$user" == "" ]; then
- user=root;
- defaultsfile="--defaults-extra-file=$configfile"
-else
+# else, if a user is set use her .my.cnf
+elif [ -n "$user" ]
+then
userset=true;
if [ $usevserver = yes ]
then
@@ -169,6 +166,10 @@ else
defaultsfile="--defaults-extra-file=$userhome/.my.cnf"
debug "using $defaultsfile"
+# otherwise use $configfile
+else
+ user=root
+ defaultsfile="--defaults-extra-file=$configfile"
fi
#######################################################################