--- mysql_install_db.orig 2013-08-17 10:09:44.286222200 +0200 +++ mysql_install_db 2013-08-17 10:11:59.694232600 +0200 @@ -427,36 +427,39 @@ # ---------------------------------------------------------------------- # This will be the default config file # ---------------------------------------------------------------------- +my $failed_write_cfg= 0; +my $cfg_template; -$config_file= "$basedir/my.cnf"; +if ( ! $opt->{'defaults-file'} ) { + $config_file= "$basedir/my.cnf"; -my $cfg_template= find_in_basedir($opt,"file","my-default.cnf", - "share","share/mysql","support-files"); --e $cfg_template or cannot_find_file("my-default.cnf"); + my $cfg_template= find_in_basedir($opt,"file","my-default.cnf", + "share","share/mysql","support-files"); + -e $cfg_template or cannot_find_file("my-default.cnf"); -$copy_cfg_file= $config_file; -my $failed_write_cfg= 0; -if (-e $copy_cfg_file) -{ - $copy_cfg_file =~ s/my.cnf/my-new.cnf/; - # Too early to print warning here, the user may not notice -} -open (TEMPL, $cfg_template) or error($opt, "Could not open config template $cfg_template"); -if (open (CFG, "> $copy_cfg_file")) -{ - while () - { - # Remove lines beginning with # *** which are template comments - print CFG $_ unless /^# \*\*\*/; - } - close CFG; -} -else -{ - warning($opt,"Could not write to config file $copy_cfg_file: $!"); - $failed_write_cfg= 1; + $copy_cfg_file= $config_file; + if (-e $copy_cfg_file) + { + $copy_cfg_file =~ s/my.cnf/my-new.cnf/; + # Too early to print warning here, the user may not notice + } + open (TEMPL, $cfg_template) or error($opt, "Could not open config template $cfg_template"); + if (open (CFG, "> $copy_cfg_file")) + { + while () + { + # Remove lines beginning with # *** which are template comments + print CFG $_ unless /^# \*\*\*/; + } + close CFG; + } + else + { + warning($opt,"Could not write to config file $copy_cfg_file: $!"); + $failed_write_cfg= 1; + } + close TEMPL; } -close TEMPL; # ---------------------------------------------------------------------- # Now we can get arguments from the groups [mysqld] and [mysql_install_db]