From: Date: June 25 2005 2:14am Subject: bk commit into 4.1 tree (jimw:1.2318) BUG#7249 List-Archive: http://lists.mysql.com/internals/26422 X-Bug: 7249 Message-Id: <20050625001420.1C443A88C9@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 4.1 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2318 05/06/24 17:14:16 jimw@stripped +1 -0 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 1.75 05/06/24 17:14:13 jimw@stripped +29 -11 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. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-4.1-7249 --- 1.74/scripts/mysqld_safe.sh 2005-04-20 11:10:25 -07:00 +++ 1.75/scripts/mysqld_safe.sh 2005-06-24 17:14:13 -07:00 @@ -84,29 +84,47 @@ } +# +# 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@