summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-07-12 08:20:24 +0300
committermonty@mysql.com <>2004-07-12 08:20:24 +0300
commit31fe2837f9c0579454cba635ee127536a6ac55ce (patch)
tree4b4523bbabccb4e51b85fc209e3274f249f85ef8 /scripts
parentfa7f63d46d033c1c1651d8f5155070e30c607023 (diff)
parent79b3b220be3e914bf2fded18a503895de212389a (diff)
downloadmariadb-git-31fe2837f9c0579454cba635ee127536a6ac55ce.tar.gz
Merge with 4.1
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mysql_fix_privilege_tables.sh24
-rw-r--r--scripts/mysqlhotcopy.sh16
2 files changed, 27 insertions, 13 deletions
diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh
index f3c5c009f1c..79b4bc627b7 100644
--- a/scripts/mysql_fix_privilege_tables.sh
+++ b/scripts/mysql_fix_privilege_tables.sh
@@ -17,8 +17,24 @@ bindir=""
file=mysql_fix_privilege_tables.sql
+# The following test is to make this script compatible with the 4.0 where
+# the single argument could be a password
+if test "$#" = 1
+then
+ case "$1" in
+ --*) ;;
+ *) old_style_password="$1" ; shift ;;
+ esac
+fi
+
# The following code is almost identical to the code in mysql_install_db.sh
+case "$1" in
+ --no-defaults|--defaults-file=*|--defaults-extra-file=*)
+ defaults="$1"; shift
+ ;;
+esac
+
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
@@ -36,7 +52,7 @@ parse_arguments() {
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--password=*) password=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--host=*) host=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --sql|--sql-only) sql_only=1;;
+ --sql|--sql-only) sql_only=1 ;;
--verbose) verbose=1 ;;
--port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;;
--socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
@@ -47,7 +63,7 @@ parse_arguments() {
then
# This sed command makes sure that any special chars are quoted,
# so the arg gets passed exactly to the server.
- args="$args "`echo "$arg" | sed -e 's,\([^a-zA-Z0-9_.-]\),\\\\\1,g'`
+ args="$args "`echo "$arg" | sed -e 's,\([^=a-zA-Z0-9_.-]\),\\\\\1,g'`
fi
;;
esac
@@ -94,11 +110,9 @@ else
fi
fi
-# The following test is to make this script compatible with the 4.0 where
-# the first argument was the password
if test -z "$password"
then
- password=`echo $args | sed -e 's/ *//g'`
+ password=$old_style_password
fi
cmd="$bindir/mysql -f --user=$user --host=$host"
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index 6388855eaa6..af4e6084c59 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -8,6 +8,7 @@ use File::Path;
use DBI;
use Sys::Hostname;
use File::Copy;
+use File::Temp;
=head1 NAME
@@ -626,7 +627,6 @@ sub copy_files {
sub copy_index
{
my ($method, $files, $source, $target) = @_;
- my $tmpfile="$opt_tmpdir/mysqlhotcopy$$";
print "Copying indices for ".@$files." files...\n" unless $opt{quiet};
foreach my $file (@$files)
@@ -652,23 +652,23 @@ sub copy_index
}
close OUTPUT || die "Error on close of $to: $!\n";
}
- elsif ($opt{method} eq 'scp')
+ elsif ($opt{method} =~ /^scp\b/)
{
- my $tmp=$tmpfile;
- open(OUTPUT,">$tmp") || die "Can\'t create file $tmp: $!\n";
- if (syswrite(OUTPUT,$buff) != length($buff))
+ my ($fh, $tmp)=tempfile('mysqlhotcopy-XXXXXX', DIR => $opt_tmpdir);
+ die "Can\'t create/open file in $opt_tmpdir\n";
+ if (syswrite($fh,$buff) != length($buff))
{
die "Error when writing data to $tmp: $!\n";
}
- close OUTPUT || die "Error on close of $tmp: $!\n";
- safe_system("scp $tmp $to");
+ close $fh || die "Error on close of $tmp: $!\n";
+ safe_system("$opt{method} $tmp $to");
+ unlink $tmp;
}
else
{
die "Can't use unsupported method '$opt{method}'\n";
}
}
- unlink "$tmpfile" if ($opt{method} eq 'scp');
}