version 1.16, 2019/10/02 22:28:24
|
version 1.22, 2021/12/21 13:57:47
|
Line 113 if ($dist =~ /^fedora(\d+)$/) {
|
Line 113 if ($dist =~ /^fedora(\d+)$/) {
|
key => 'gpgkey=', |
key => 'gpgkey=', |
value => $gpg, |
value => $gpg, |
}],$nobackup); |
}],$nobackup); |
} elsif ($dist =~ /^(rhes|centos|scientific|oracle)(\d+)$/) { |
} elsif ($dist =~ /^(rhes|centos|scientific|oracle|rocky|alma)(\d+)(|\-stream)$/) { |
my $type = $1; |
my $type = $1; |
my $ver = $2; |
my $ver = $2; |
|
my $stream = $3; |
my $longver = $ver; |
my $longver = $ver; |
my $nobackup; |
my $nobackup; |
if ($type eq 'rhes') { |
if ($type eq 'rhes') { |
Line 124 if ($dist =~ /^fedora(\d+)$/) {
|
Line 125 if ($dist =~ /^fedora(\d+)$/) {
|
} elsif ($ver == 5) { |
} elsif ($ver == 5) { |
$longver = '5Server'; |
$longver = '5Server'; |
} |
} |
|
} elsif ($type eq 'centos') { |
|
$type .= $stream; |
} |
} |
my %info = ( |
my %info = ( |
rhes => { |
rhes => { |
Line 150 if ($dist =~ /^fedora(\d+)$/) {
|
Line 153 if ($dist =~ /^fedora(\d+)$/) {
|
gpg => 'versions/oracle/RPM-GPG-KEY-loncapa', |
gpg => 'versions/oracle/RPM-GPG-KEY-loncapa', |
gpgchk => 1, |
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 (ref($info{$type}) eq 'HASH') { |
if ($ver > 4) { |
if ($ver > 4) { |
my $file = '/etc/yum.conf'; |
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'; |
$file = '/etc/yum.repos.d/loncapa.repo'; |
$nobackup = 1; |
$nobackup = 1; |
} |
} |
|
my $release = '$releasever'; |
|
if ($type eq 'centos-stream') { |
|
$release .= '-stream'; |
|
} |
$yum_status = |
$yum_status = |
&update_file($file, |
&update_file($file, |
[{section => 'loncapa-updates-basearch', |
[{section => 'loncapa-updates-basearch', |
Line 165 if ($dist =~ /^fedora(\d+)$/) {
|
Line 191 if ($dist =~ /^fedora(\d+)$/) {
|
value => $info{$type}{title}.' $releasever LON-CAPA $basearch Updates', |
value => $info{$type}{title}.' $releasever LON-CAPA $basearch Updates', |
}, {section => "loncapa-updates-basearch", |
}, {section => "loncapa-updates-basearch", |
key => 'baseurl=', |
key => 'baseurl=', |
value => "$loninst/$info{$type}{path}/".'$releasever/$basearch', |
value => "$loninst/$info{$type}{path}/$release/".'$basearch', |
}, {section => 'loncapa-updates-basearch', |
}, {section => 'loncapa-updates-basearch', |
key => 'gpgcheck=', |
key => 'gpgcheck=', |
value => $info{$type}{gpgchk}, |
value => $info{$type}{gpgchk}, |
Line 177 if ($dist =~ /^fedora(\d+)$/) {
|
Line 203 if ($dist =~ /^fedora(\d+)$/) {
|
value => $info{$type}{title}.' $releasever LON-CAPA noarch Updates', |
value => $info{$type}{title}.' $releasever LON-CAPA noarch Updates', |
}, {section => 'loncapa-updates-noarch', |
}, {section => 'loncapa-updates-noarch', |
key => 'baseurl=', |
key => 'baseurl=', |
value => "$loninst/$info{$type}{path}/".'$releasever/noarch', |
value => "$loninst/$info{$type}{path}/$release/noarch", |
}, {section => 'loncapa-updates-noarch', |
}, {section => 'loncapa-updates-noarch', |
key => 'gpgcheck=', |
key => 'gpgcheck=', |
value => $info{$type}{gpgchk}, |
value => $info{$type}{gpgchk}, |
Line 202 if ($dist =~ /^fedora(\d+)$/) {
|
Line 228 if ($dist =~ /^fedora(\d+)$/) {
|
} elsif ($dist =~ /^(debian|ubuntu)\d+$/) { |
} elsif ($dist =~ /^(debian|ubuntu)\d+$/) { |
my %apt_get_source = ( |
my %apt_get_source = ( |
debian5 => { |
debian5 => { |
regexp => '\s*deb\s+'.$loninst_re.'/debian/\s+lenny\s+main', |
regexp => '\s*deb\s+'.$loninst_re.'/debian/?\s+lenny\s+main', |
text => "deb $loninst/debian/ lenny main", |
text => "deb $loninst/debian lenny main", |
}, |
}, |
ubuntu6 => { |
ubuntu6 => { |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+dapper\s+main', |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+dapper\s+main', |
text => "deb $loninst/ubuntu/ dapper main", |
text => "deb $loninst/ubuntu dapper main", |
}, |
}, |
ubuntu8 => { |
ubuntu8 => { |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+hardy\s+main', |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+hardy\s+main', |
text => "deb $loninst/ubuntu/ hardy main", |
text => "deb $loninst/ubuntu hardy main", |
}, |
}, |
ubuntu10 => { |
ubuntu10 => { |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+lucid\s+main', |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+lucid\s+main', |
text => "deb $loninst/ubuntu/ lucid main", |
text => "deb $loninst/ubuntu lucid main", |
}, |
}, |
ubuntu12 => { |
ubuntu12 => { |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+precise\s+main', |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+precise\s+main', |
text => "deb $loninst/ubuntu/ precise main", |
text => "deb $loninst/ubuntu precise main", |
}, |
}, |
ubuntu14 => { |
ubuntu14 => { |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+trusty\s+main', |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+trusty\s+main', |
text => "deb $loninst/ubuntu/ trusty main", |
text => "deb $loninst/ubuntu trusty main", |
}, |
}, |
ubuntu16 => { |
ubuntu16 => { |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+xenial\s+main', |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+xenial\s+main', |
text => "deb $loninst/ubuntu/ xenial main", |
text => "deb $loninst/ubuntu xenial main", |
}, |
}, |
ubuntu18 => { |
ubuntu18 => { |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+bionic\s+main', |
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+bionic\s+main', |
text => "deb $loninst/ubuntu/ bionic main", |
text => "deb $loninst/ubuntu bionic main", |
|
}, |
|
ubuntu20 => { |
|
regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+focal\s+main', |
|
text => "deb $loninst/ubuntu focal main", |
}, |
}, |
); |
); |
my $apt_status; |
my $apt_status; |
Line 240 if ($dist =~ /^fedora(\d+)$/) {
|
Line 270 if ($dist =~ /^fedora(\d+)$/) {
|
} |
} |
} |
} |
|
|
my $mysql_global_status = |
my $mysqlfile = '/etc/my.cnf'; |
&update_file('/etc/my.cnf', |
my $mysqlconf = [{section =>'mysqld', |
[{section =>'mysqld', |
key =>'wait_timeout=', |
key =>'wait_timeout=', |
value =>'31536000'}]; |
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,$mysqlconf); |
|
|
my $local_my_cnf = '/home/www/.my.cnf'; |
my $local_my_cnf = '/home/www/.my.cnf'; |
if (! -e $local_my_cnf) { |
if (! -e $local_my_cnf) { |
Line 372 sub write_config_file {
|
Line 421 sub write_config_file {
|
if (! defined($structure) || ! ref($structure)) { |
if (! defined($structure) || ! ref($structure)) { |
return 'Bad subroutine inputs'; |
return 'Bad subroutine inputs'; |
} |
} |
open(OUTPUT,'>'.$file) || return('Unable to open '.$file.' for writing'); |
open(OUTPUT,'>',$file) || return('Unable to open '.$file.' for writing'); |
for (my $i=0;$i<scalar(@$structure);$i++) { |
for (my $i=0;$i<scalar(@$structure);$i++) { |
my $line = $structure->[$i]; |
my $line = $structure->[$i]; |
chomp($line); |
chomp($line); |
Line 515 sub update_rhn_source {
|
Line 564 sub update_rhn_source {
|
} |
} |
my $result = 0; |
my $result = 0; |
my $fh; |
my $fh; |
if (open($fh,"<$file")) { |
if (open($fh,'<',$file)) { |
my $total = 0; |
my $total = 0; |
my %found; |
my %found; |
foreach my $item (keys(%{$rhn_items})) { |
foreach my $item (keys(%{$rhn_items})) { |
Line 537 sub update_rhn_source {
|
Line 586 sub update_rhn_source {
|
} |
} |
close($fh); |
close($fh); |
if ($total < 2) { |
if ($total < 2) { |
if (open($fh,">>$file")) { |
if (open($fh,'>>',$file)) { |
foreach my $item (keys(%{$rhn_items})) { |
foreach my $item (keys(%{$rhn_items})) { |
unless ($found{$item}) { |
unless ($found{$item}) { |
if (ref($rhn_items->{$item}) eq 'HASH') { |
if (ref($rhn_items->{$item}) eq 'HASH') { |
Line 592 sub update_apt_source {
|
Line 641 sub update_apt_source {
|
} |
} |
my $result = 0; |
my $result = 0; |
my $fh; |
my $fh; |
if (open($fh,"<$file")) { |
if (open($fh,'<',$file)) { |
my $found = 0; |
my $found = 0; |
my $pattern = $deb_row->{regexp}; |
my $pattern = $deb_row->{regexp}; |
while(<$fh>) { |
while(<$fh>) { |
Line 603 sub update_apt_source {
|
Line 652 sub update_apt_source {
|
} |
} |
close($fh); |
close($fh); |
if (!$found) { |
if (!$found) { |
if (open($fh,">>$file")) { |
if (open($fh,'>>',$file)) { |
print $fh "\n".$deb_row->{text}."\n"; |
print $fh "\n".$deb_row->{text}."\n"; |
close($fh); |
close($fh); |
$result = 1; |
$result = 1; |