--- loncom/debugging_tools/modify_config_files.pl 2021/03/22 21:15:53 1.19 +++ loncom/debugging_tools/modify_config_files.pl 2021/12/21 15:43:57 1.23 @@ -2,7 +2,7 @@ # # The LearningOnline Network # -# $Id: modify_config_files.pl,v 1.19 2021/03/22 21:15:53 raeburn Exp $ +# $Id: modify_config_files.pl,v 1.23 2021/12/21 15:43:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -113,9 +113,10 @@ if ($dist =~ /^fedora(\d+)$/) { key => 'gpgkey=', value => $gpg, }],$nobackup); -} elsif ($dist =~ /^(rhes|centos|scientific|oracle)(\d+)$/) { +} elsif ($dist =~ /^(rhes|centos|scientific|oracle|rocky|alma)(\d+)(|\-stream)$/) { my $type = $1; my $ver = $2; + my $stream = $3; my $longver = $ver; my $nobackup; if ($type eq 'rhes') { @@ -124,6 +125,8 @@ if ($dist =~ /^fedora(\d+)$/) { } elsif ($ver == 5) { $longver = '5Server'; } + } elsif ($type eq 'centos') { + $type .= $stream; } my %info = ( rhes => { @@ -150,14 +153,37 @@ if ($dist =~ /^fedora(\d+)$/) { gpg => 'versions/oracle/RPM-GPG-KEY-loncapa', gpgchk => 1, }, + rocky => { + title => 'Rocky Linux', + path => 'rocky/loncapa', + gpg => 'versions/rocky/RPM-GPG-KEY-loncapa', + gpgchk => 1, + }, + alma => { + title => 'AlmaLinux', + path => 'alma/loncapa', + gpg => 'versions/alma/RPM-GPG-KEY-loncapa', + gpgchk => 1, + }, + 'centos-stream' => { + title => 'CentOS Stream', + path => 'centos/loncapa', + gpg => 'versions/centos/RPM-GPG-KEY-loncapa', + gpgchk => 1, + }, ); if (ref($info{$type}) eq 'HASH') { if ($ver > 4) { my $file = '/etc/yum.conf'; - if (($ver > 7) || ($type eq 'oracle')) { + if (($ver > 7) || ($type eq 'oracle') || ($type eq 'rocky') || + ($type eq 'alma') || ($type eq 'centos-stream')) { $file = '/etc/yum.repos.d/loncapa.repo'; $nobackup = 1; } + my $release = '$releasever'; + if ($type eq 'centos-stream') { + $release .= '-stream'; + } $yum_status = &update_file($file, [{section => 'loncapa-updates-basearch', @@ -165,7 +191,7 @@ if ($dist =~ /^fedora(\d+)$/) { value => $info{$type}{title}.' $releasever LON-CAPA $basearch Updates', }, {section => "loncapa-updates-basearch", key => 'baseurl=', - value => "$loninst/$info{$type}{path}/".'$releasever/$basearch', + value => "$loninst/$info{$type}{path}/$release/".'$basearch', }, {section => 'loncapa-updates-basearch', key => 'gpgcheck=', value => $info{$type}{gpgchk}, @@ -177,7 +203,7 @@ if ($dist =~ /^fedora(\d+)$/) { value => $info{$type}{title}.' $releasever LON-CAPA noarch Updates', }, {section => 'loncapa-updates-noarch', key => 'baseurl=', - value => "$loninst/$info{$type}{path}/".'$releasever/noarch', + value => "$loninst/$info{$type}{path}/$release/noarch", }, {section => 'loncapa-updates-noarch', key => 'gpgcheck=', value => $info{$type}{gpgchk}, @@ -245,19 +271,29 @@ if ($dist =~ /^fedora(\d+)$/) { } my $mysqlfile = '/etc/my.cnf'; +my $mysqlconf = [{section =>'mysqld', + key =>'wait_timeout=', + value =>'31536000'}]; if ($dist =~ /^ubuntu(\d+)$/) { my $version = $1; $mysqlfile = '/etc/mysql/my.cnf'; if ($version > 14) { $mysqlfile = '/etc/mysql/mysql.conf.d/mysqld.cnf'; + if ($version < 20) { + push(@{$mysqlconf}, + {section =>'mysqld', + key =>'sql_mode=', + value =>'"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'}); + } else { + push(@{$mysqlconf}, + {section =>'mysqld', + key =>'sql_mode=', + value =>'"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"'}); + } } } -my $mysql_global_status = - &update_file($mysqlfile, - [{section =>'mysqld', - key =>'wait_timeout=', - value =>'31536000', }]); +my $mysql_global_status = &update_file($mysqlfile,$mysqlconf); my $local_my_cnf = '/home/www/.my.cnf'; if (! -e $local_my_cnf) {