--- loncom/debugging_tools/modify_config_files.pl 2004/08/09 21:05:40 1.1 +++ loncom/debugging_tools/modify_config_files.pl 2004/08/11 17:32:53 1.3 @@ -2,7 +2,7 @@ # # The LearningOnline Network # -# $Id: modify_config_files.pl,v 1.1 2004/08/09 21:05:40 matthew Exp $ +# $Id: modify_config_files.pl,v 1.3 2004/08/11 17:32:53 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -49,6 +49,9 @@ copies of each file are made in /etc. use strict; use File::Copy; +use lib '/home/httpd/lib/perl/'; +use LONCAPA::Configuration; +my $loncapa_config=LONCAPA::Configuration::read_conf('loncapa.conf'); &update_file('/etc/yum.conf', [{section => 'loncapa-updates-i386', @@ -72,6 +75,20 @@ use File::Copy; key =>'set-variable=wait_timeout=', value =>'31536000', }]); + +my $local_my_cnf = '/home/www/.my.cnf'; +if (! -e $local_my_cnf) { +# # Create a file so we can do something with it... + system("touch $local_my_cnf"); +} +&update_file($local_my_cnf, + [{section =>'client', + key =>'user=', + value =>'www',}, + {section =>'client', + key =>'password=', + value =>$loncapa_config->{'lonSqlAccess'}},]); + exit; @@ -259,7 +276,7 @@ sub modify_config_file { unshift(@$target,$newline); } else { # No need to put things after a blank line. - if ($target->[-1] =~ /^\s*$/) { + if (defined($target->[-1]) && $target->[-1] =~ /^\s*$/) { $target->[-1] = $newline; } else { push(@$target,$newline);