mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fixes for binary distribution in tar file
- mysql_install_db doesn't require --basedir option anymore - Fix that mysql_install_db mysqld_safe mysql_fix_privilege_tables has right paths for tar binary install - Move some files from share/mysql to where they have always been (1.0 - 5.0) - Move scripts used when installing MariaDB to the scripts directory (Added symlinks in old place for compatibility) - Move man files to 'man' (from 'share/man') - Ensure that all scripts are executable mysql_secure_installation.sh - Added support for --basedir flag - Don't assume that the mysql binary is in the path Other: - Fixed crash when one got kill signal during bootstrap Docs/INSTALL-BINARY: Change references from MySQL to MariaDB Docs/mysql.info: Change references from MySQL to MariaDB README: Removed duplicate row configure.in: Change references from MySQL to MariaDB libmysql/libmysql.c: Assume that if version string contains '-maria-' we are also using MariaDB scripts/make_binary_distribution.sh: Fix that mysql_install_db mysqld_safe mysql_fix_privilege_tables has right paths for tar binary install Remove some files that should not be part of a MariaDB binary install Move some files from share/mysql to where they have always been (1.0 - 5.0) Move man files to 'man' (from 'share/man') Move scripts used when installing MariaDB to the scripts directory (Added symlinks in old place for compatibility) Removed generation of 'netware/init_db.sql', as it was never used Remove old reference to bk tree scripts/mysql_secure_installation.sh: Added support for --basedir flag Don't assume that the mysql binary is in the path Use .my.cnf files Removed a lot of useless 'echo' rows sql/mysqld.cc: Fixed crash when one got kill signal during bootstrap storage/maria/Makefile.am: Don't add internal test files to binary distributions storage/myisam/Makefile.am: Don't add internal test files to binary distributions support-files/Makefile.am: Make scripts executable support-files/config.huge.ini.sh: Removed execution bit support-files/config.medium.ini.sh: Removed execution bit support-files/config.small.ini.sh: Removed execution bit support-files/mysql.server.sh: Ensure this works also mysqld is in the 'bin' directory
This commit is contained in:
@@ -23,6 +23,157 @@ trap "interrupt" 2
|
||||
rootpass=""
|
||||
echo_n=
|
||||
echo_c=
|
||||
basedir=
|
||||
bindir=
|
||||
|
||||
parse_arg()
|
||||
{
|
||||
echo "$1" | sed -e 's/^[^=]*=//'
|
||||
}
|
||||
|
||||
parse_arguments()
|
||||
{
|
||||
# We only need to pass arguments through to the server if we don't
|
||||
# handle them here. So, we collect unrecognized options (passed on
|
||||
# the command line) into the args variable.
|
||||
pick_args=
|
||||
if test "$1" = PICK-ARGS-FROM-ARGV
|
||||
then
|
||||
pick_args=1
|
||||
shift
|
||||
fi
|
||||
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
--basedir=*) basedir=`parse_arg "$arg"` ;;
|
||||
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
|
||||
defaults="$arg" ;;
|
||||
*)
|
||||
if test -n "$pick_args"
|
||||
then
|
||||
# This sed command makes sure that any special chars are quoted,
|
||||
# so the arg gets passed exactly to the server.
|
||||
# XXX: This is broken; true fix requires using eval and proper
|
||||
# quoting of every single arg ($basedir, $ldata, etc.)
|
||||
#args="$args "`echo "$arg" | sed -e 's,\([^a-zA-Z0-9_.-]\),\\\\\1,g'`
|
||||
args="$args $arg"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Try to find a specific file within --basedir which can either be a binary
|
||||
# release or installed source directory and return the path.
|
||||
find_in_basedir()
|
||||
{
|
||||
return_dir=
|
||||
case "$1" in
|
||||
--dir)
|
||||
return_dir=1; shift
|
||||
;;
|
||||
esac
|
||||
|
||||
file=$1; shift
|
||||
|
||||
for dir in "$@"
|
||||
do
|
||||
if test -f "$basedir/$dir/$file"
|
||||
then
|
||||
if test -n "$return_dir"
|
||||
then
|
||||
echo "$basedir/$dir"
|
||||
else
|
||||
echo "$basedir/$dir/$file"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cannot_find_file()
|
||||
{
|
||||
echo
|
||||
echo "FATAL ERROR: Could not find $1"
|
||||
|
||||
shift
|
||||
if test $# -ne 0
|
||||
then
|
||||
echo
|
||||
echo "The following directories were searched:"
|
||||
echo
|
||||
for dir in "$@"
|
||||
do
|
||||
echo " $dir"
|
||||
done
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "If you compiled from source, you need to run 'make install' to"
|
||||
echo "copy the software into the correct location ready for operation."
|
||||
echo
|
||||
echo "If you are using a binary release, you must either be at the top"
|
||||
echo "level of the extracted archive, or pass the --basedir option"
|
||||
echo "pointing to that location."
|
||||
echo
|
||||
}
|
||||
|
||||
# Ok, let's go. We first need to parse arguments which are required by
|
||||
# my_print_defaults so that we can execute it first, then later re-parse
|
||||
# the command line to add any extra bits that we need.
|
||||
parse_arguments PICK-ARGS-FROM-ARGV "$@"
|
||||
|
||||
#
|
||||
# We can now find my_print_defaults. This script supports:
|
||||
#
|
||||
# --srcdir=path pointing to compiled source tree
|
||||
# --basedir=path pointing to installed binary location
|
||||
#
|
||||
# or default to compiled-in locations.
|
||||
#
|
||||
|
||||
if test -n "$basedir"
|
||||
then
|
||||
print_defaults=`find_in_basedir my_print_defaults bin extra`
|
||||
echo "print: $print_defaults"
|
||||
if test -z "$print_defaults"
|
||||
then
|
||||
cannot_find_file my_print_defaults $basedir/bin $basedir/extra
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_defaults="@bindir@/my_print_defaults"
|
||||
fi
|
||||
|
||||
if test ! -x "$print_defaults"
|
||||
then
|
||||
cannot_find_file "$print_defaults"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Now we can get arguments from the group [client]
|
||||
# in the my.cfg file, then re-run to merge with command line arguments.
|
||||
parse_arguments `$print_defaults $defaults client`
|
||||
parse_arguments PICK-ARGS-FROM-ARGV "$@"
|
||||
|
||||
# Configure paths to support files
|
||||
if test -n "$basedir"
|
||||
then
|
||||
bindir="$basedir/bin"
|
||||
elif test -f "./bin/mysql"
|
||||
then
|
||||
bindir="./bin"
|
||||
else
|
||||
bindir="@bindir@"
|
||||
fi
|
||||
|
||||
mysql_command=`find_in_basedir mysql $bindir`
|
||||
if test -z "$print_defaults"
|
||||
then
|
||||
cannot_find_file mysql $bindir
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set_echo_compat() {
|
||||
case `echo "testing\c"`,`echo -n testing` in
|
||||
@@ -39,7 +190,7 @@ prepare() {
|
||||
|
||||
do_query() {
|
||||
echo $1 >$command
|
||||
mysql --defaults-file=$config <$command
|
||||
$bindir/mysql --defaults-file=$config <$command
|
||||
return $?
|
||||
}
|
||||
|
||||
@@ -184,15 +335,10 @@ cleanup() {
|
||||
prepare
|
||||
set_echo_compat
|
||||
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo "NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL"
|
||||
echo " SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!"
|
||||
echo
|
||||
echo
|
||||
|
||||
echo "In order to log into MySQL to secure it, we'll need the current"
|
||||
echo "password for the root user. If you've just installed MySQL, and"
|
||||
echo "you haven't set the root password yet, the password will be blank,"
|
||||
@@ -309,14 +455,9 @@ echo
|
||||
|
||||
cleanup
|
||||
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo "All done! If you've completed all of the above steps, your MySQL"
|
||||
echo "installation should now be secure."
|
||||
echo
|
||||
echo "Thanks for using MySQL!"
|
||||
echo
|
||||
echo
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user