diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-01-10 13:54:04 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-01-10 13:54:04 +0100 |
commit | bd87fed1dc0caa0720e5a60f0fca1b714c58ac75 (patch) | |
tree | 78117460df06878cb987630a95e6304b587a7f39 /scripts | |
parent | 3c987667d903826e8643f7835f102272ce98987e (diff) | |
parent | 2e11ca36f28133c18b72351d176ee2fd7fcbc465 (diff) | |
download | mariadb-git-bd87fed1dc0caa0720e5a60f0fca1b714c58ac75.tar.gz |
5.1 merge
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mysql_install_db.pl.in | 17 | ||||
-rw-r--r-- | scripts/mysqld_multi.sh | 22 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 35 |
3 files changed, 73 insertions, 1 deletions
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in index e20dc43867f..ddeedee6375 100644 --- a/scripts/mysql_install_db.pl.in +++ b/scripts/mysql_install_db.pl.in @@ -423,8 +423,11 @@ my $mysqld_install_cmd_line = quote_options($mysqld_bootstrap, "--bootstrap", "--basedir=$opt->{basedir}", "--datadir=$opt->{ldata}", + "--log-warnings=0", "--loose-skip-innodb", + "--loose-skip-ndbcluster", "--max_allowed_packet=8M", + "--default-storage-engine=MyISAM", "--net_buffer_length=16K", @args, ); @@ -437,6 +440,8 @@ report_verbose_wait($opt,"Installing MySQL system tables..."); open(SQL, $create_system_tables) or error($opt,"can't open $create_system_tables for reading: $!"); +open(SQL2, $fill_system_tables) + or error($opt,"can't open $fill_system_tables for reading: $!"); # FIXME > /dev/null ? if ( open(PIPE, "| $mysqld_install_cmd_line") ) { @@ -450,8 +455,20 @@ if ( open(PIPE, "| $mysqld_install_cmd_line") ) print PIPE $_; } + while ( <SQL2> ) + { + # TODO: make it similar to the above condition when we're sure + # @@hostname returns a fqdn + # When doing a "cross bootstrap" install, no reference to the current + # host should be added to the system tables. So we filter out any + # lines which contain the current host name. + next if /\@current_hostname/; + + print PIPE $_; + } close PIPE; close SQL; + close SQL2; report_verbose($opt,"OK"); diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index ad6584f0571..e70672e8b25 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -47,6 +47,28 @@ $homedir = $ENV{HOME}; $my_progname = $0; $my_progname =~ s/.*[\/]//; + +if (defined($ENV{UMASK})) { + my $UMASK = $ENV{UMASK}; + my $m; + my $fmode = "0640"; + + if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) { + printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n"); + printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); } + else { + $fmode= substr $UMASK, 2, 2; + $fmode= "06${fmode}"; } + + if($fmode != $UMASK) { + printf("UMASK corrected from $UMASK to $fmode ...\n"); } + + $fmode= oct($fmode); + + umask($fmode); +} + + main(); #### diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index cae63343cfc..7eb123b83e2 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -27,7 +27,28 @@ syslog_tag_mysqld_safe=mysqld_safe trap '' 1 2 3 15 # we shouldn't let anyone kill us -umask 007 +# MySQL-specific environment variable. First off, it's not really a umask, +# it's the desired mode. Second, it follows umask(2), not umask(3) in that +# octal needs to be explicit. Our shell might be a proper sh without printf, +# multiple-base arithmetic, and binary arithmetic, so this will get ugly. +# We reject decimal values to keep things at least half-sane. +umask 007 # fallback +UMASK="${UMASK-0640}" +fmode=`echo "$UMASK" | sed -e 's/[^0246]//g'` +octalp=`echo "$fmode"|cut -c1` +fmlen=`echo "$fmode"|wc -c|sed -e 's/ //g'` +if [ "x$octalp" != "x0" -o "x$UMASK" != "x$fmode" -o "x$fmlen" != "x5" ] +then + fmode=0640 + echo "UMASK must be a 3-digit mode with an additional leading 0 to indicate octal." >&2 + echo "The first digit will be corrected to 6, the others may be 0, 2, 4, or 6." >&2 +fi +fmode=`echo "$fmode"|cut -c3-4` +fmode="6$fmode" +if [ "x$UMASK" != "x0$fmode" ] +then + echo "UMASK corrected from $UMASK to 0$fmode ..." +fi defaults= case "$1" in @@ -375,6 +396,12 @@ then # Log to err_log file log_notice "Logging to '$err_log'." logging=file + + if [ ! -e "$err_log" ]; then # if error log already exists, + touch "$err_log" # we just append. otherwise, + chmod "$fmode" "$err_log" # fix the permissions here! + fi + else if [ -n "$syslog_tag" ] then @@ -580,6 +607,12 @@ do eval_log_error "$cmd" + if [ $want_syslog -eq 0 -a ! -e "$err_log" ]; then + touch "$err_log" # hypothetical: log was renamed but not + chown $user "$err_log" # flushed yet. we'd recreate it with + chmod "$fmode" "$err_log" # wrong owner next time we log, so set + fi # it up correctly while we can! + if test ! -f "$pid_file" # This is removed if normal shutdown then break |