summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-06-24 17:14:16 -0700
committerunknown <jimw@mysql.com>2005-06-24 17:14:16 -0700
commit3e7a57632a508381f80aba5a503eb4f3fc3babb6 (patch)
treefb3129e577aece9dc34d9c3bacbea894d300024a
parenta7e66efc2cc37b8ca32868ac8c8e3e3c05675e48 (diff)
downloadmariadb-git-3e7a57632a508381f80aba5a503eb4f3fc3babb6.tar.gz
Fix handling of datadir by mysqld_safe to support specifying a
different DATADIR via the command line or during ./configure and still starting up mysqld_safe via a relative path. (Bug #7249) scripts/mysqld_safe.sh: Decouple figuring out which BASEDIR and DATADIR to use so that the only DATADIR we'll try to use without first verifying that it exists is the compiled-in default.
-rw-r--r--scripts/mysqld_safe.sh40
1 files changed, 29 insertions, 11 deletions
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 8a232f4f7f9..d6585f4a552 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -84,31 +84,49 @@ parse_arguments() {
}
+#
+# First, try to find BASEDIR and ledir (where mysqld is)
+#
+
MY_PWD=`pwd`
-# Check if we are starting this relative (for the binary release)
-if test -f ./share/mysql/english/errmsg.sys -a \
- -x ./bin/mysqld
+# Check for the directories we would expect from a binary release install
+if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld
then
MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are
ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is
- DATADIR=$MY_BASEDIR_VERSION/data
- if test -z "$defaults"
- then
- defaults="--defaults-extra-file=$MY_BASEDIR_VERSION/data/my.cnf"
- fi
-# Check if this is a 'moved install directory'
+# Check for the directories we would expect from a source install
elif test -f ./share/mysql/english/errmsg.sys -a \
-x ./libexec/mysqld
then
MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are
ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is
- DATADIR=$MY_BASEDIR_VERSION/var
+# Since we didn't find anything, used the compiled-in defaults
else
MY_BASEDIR_VERSION=@prefix@
- DATADIR=@localstatedir@
ledir=@libexecdir@
fi
+#
+# Second, try to find the data directory
+#
+
+# Try where the binary installs put it
+if test -d $MY_BASEDIR_VERSION/data/mysql
+then
+ DATADIR=$MY_BASEDIR_VERSION/data
+ if test -z "$defaults"
+ then
+ defaults="--defaults-extra-file=$DATADIR/my.cnf"
+ fi
+# Next try where the source installs put it
+elif test -d $MY_BASEDIR_VERSION/var/mysql
+then
+ DATADIR=$MY_BASEDIR_VERSION/var
+# Or just give up and use our compiled-in default
+else
+ DATADIR=@localstatedir@
+fi
+
user=@MYSQLD_USER@
niceness=0