Check for mysql after parsing options so --help works even if mysql isn't in PATH.

This commit is contained in:
Daniel Nichter
2012-01-31 13:25:20 -07:00
parent 6205505263
commit a488043774

View File

@@ -1154,15 +1154,6 @@ main() {
if [ "${0##*/}" = "$TOOL" ] \
|| [ "${0##*/}" = "bash" -a "$_" = "$0" ]; then
# Check that mysql and mysqladmin are in PATH. If not, we're
# already dead in the water, so don't bother with cmd line opts,
# just error and exit.
[ -n "$(mysql --help)" ] \
|| die "Cannot execute mysql. Check that it is in PATH."
[ -n "$(mysqladmin --help)" ] \
|| die "Cannot execute mysqladmin. Check that it is in PATH."
# Parse command line options. We must do this first so we can
# see if --daemonize was specified.
mk_tmpdir
@@ -1181,6 +1172,14 @@ if [ "${0##*/}" = "$TOOL" ] \
exit 0
fi
# Check that mysql and mysqladmin are in PATH. If not, we're
# already dead in the water, so don't bother with cmd line opts,
# just error and exit.
[ -n "$(mysql --help)" ] \
|| die "Cannot execute mysql. Check that it is in PATH."
[ -n "$(mysqladmin --help)" ] \
|| die "Cannot execute mysqladmin. Check that it is in PATH."
# Now that we have the cmd line opts, check that we can actually
# connect to MySQL.
[ -n "$(mysql $EXT_ARGV -e 'SELECT 1')" ] \