summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2009-10-23 19:48:54 +0300
committerMichael Widenius <monty@askmonty.org>2009-10-23 19:48:54 +0300
commitafd0a45639279c8de44f1358cc83c1f1b76ebb30 (patch)
treeb97c4fb20305987760d39a69e5c71c3a19930bcd /scripts
parent1b7d4b37b4656723d898379e13830543c4d8bd45 (diff)
downloadmariadb-git-afd0a45639279c8de44f1358cc83c1f1b76ebb30.tar.gz
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
Diffstat (limited to 'scripts')
-rw-r--r--scripts/make_binary_distribution.sh54
-rw-r--r--scripts/mysql_secure_installation.sh163
2 files changed, 194 insertions, 23 deletions
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 59c5a25ac63..9595a56ef62 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -239,8 +239,8 @@ if [ x"$BASE_SYSTEM" != x"netware" ] ; then
# ----------------------------------------------------------------------
cd scripts
- rm -f mysql_install_db
- @MAKE@ mysql_install_db \
+ rm -f mysql_install_db mysqld_safe mysql_fix_privilege_tables
+ @MAKE@ mysql_install_db mysqld_safe mysql_fix_privilege_tables \
prefix=. \
bindir=./bin \
sbindir=./bin \
@@ -257,7 +257,7 @@ if [ x"$BASE_SYSTEM" != x"netware" ] ; then
sbindir=./bin \
scriptdir=./bin \
libexecdir=./bin \
- pkgdatadir=@pkgdatadir@
+ pkgdatadir=./share
cd ..
# ----------------------------------------------------------------------
@@ -320,6 +320,33 @@ if [ x"$BASE_SYSTEM" != x"netware" ] ; then
mkdir $DEST/data $DEST/data/mysql $DEST/data/test
chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test
+ # Remove not needed files
+ rm $DEST/share/mysql/errmsg.txt
+
+ # Remove NDB files
+ rm -f $DEST/share/mysql/ndb-config-2-node.ini \
+ $DEST/share/mysql/config*
+
+ #
+ # Move things to make them easier to find in tar installation
+ #
+ mv $DEST/libexec/* $DEST/bin
+ mv $DEST/share/man $DEST
+ mv $DEST/share/mysql/binary-configure $DEST/configure
+ mv $DEST/share/mysql/*.sql $DEST/share
+ mv $DEST/share/mysql/*.cnf $DEST/share/mysql/*.server $DEST/share/mysql/mysql-log-rotate $DEST/support-files
+ rmdir $DEST/libexec
+
+ #
+ # Move some scripts that are only run once to 'scripts' directory
+ # but add symbolic links instead to old place for compatibility
+ #
+ for i in mysql_secure_installation mysql_fix_extensions mysql_fix_privilege_tables
+ do
+ mv $DEST/bin/$i $DEST/scripts
+ ln -s "../scripts/$i" $DEST/bin/$i
+ done
+
# ----------------------------------------------------------------------
# Create the result tar file
# ----------------------------------------------------------------------
@@ -496,12 +523,21 @@ rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \
$BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \
$BASE/bin/make_win_* \
$BASE/bin/setsomevars $BASE/support-files/Makefile* \
- $BASE/support-files/*.sh
+ $BASE/support-files/*.sh \
+ $BASE/share/mysql/errmsg.txt
+
+# Remove NDB files
+rm -f $BASE/share/ndb-config-2-node.ini \
+ $BASE/share/mysql/config*
#
-# Copy system dependent files
+# Move things to make things easier to find in tar installation
#
-./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
+
+mv $BASE/share/man $BASE
+mv $BASE/share/mysql/binary-configure $BASE/configure
+mv $BASE/share/mysql/*.sql $BASE/share
+mv $BASE/share/mysql/*.cnf $BASE/share/mysql/*.server $BASE/share/mysql/mysql-log-rotate $BASE/support-files
#
# Remove system dependent files
@@ -515,12 +551,6 @@ rm -f $BASE/support-files/magic \
$BASE/support-files/MySQL-shared-compat.spec \
$BASE/INSTALL-BINARY
-# Clean up if we did this from a bk tree
-if [ -d $BASE/sql-bench/SCCS ] ; then
- find $BASE/share -name SCCS -print | xargs rm -rf
- find $BASE/sql-bench -name SCCS -print | xargs rm -rf
-fi
-
BASE2=$TMP/$NEW_NAME
rm -rf $BASE2
mv $BASE $BASE2
diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh
index 6c2d88d6d29..6985a58ce76 100644
--- a/scripts/mysql_secure_installation.sh
+++ b/scripts/mysql_secure_installation.sh
@@ -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 $?
}
@@ -185,14 +336,9 @@ 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,"
@@ -310,13 +456,8 @@ 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
-