version 1.24, 2024/06/28 12:46:47
|
version 1.29, 2024/07/31 03:39:20
|
Line 49 Linux distro/version being used. The fi
|
Line 49 Linux distro/version being used. The fi
|
/etc/sysconfig/rhn/sources (for RHEL4), or /etc/yum.repos.d/loncapa.repo |
/etc/sysconfig/rhn/sources (for RHEL4), or /etc/yum.repos.d/loncapa.repo |
(for Fedora >= 21; Oracle Linux; AlmaLinux; RockyLinux; CentOS/RHEL >= 8). |
(for Fedora >= 21; Oracle Linux; AlmaLinux; RockyLinux; CentOS/RHEL >= 8). |
|
|
|
The script also modifies /home/www/.inputrc on Linux distros which have |
|
readline 8.1 or newer, i.e., CentOS/Scientific Linux/RHEL >= 9, |
|
Ubuntu >= 22, Debian >= 12, and Fedora >= 34. |
|
|
=head1 DESCRIPTION |
=head1 DESCRIPTION |
|
|
This script will modify /etc/my.cnf, /etc/mysql/my.cnf, |
This script will modify /etc/my.cnf, /etc/mysql/my.cnf, |
Line 56 This script will modify /etc/my.cnf, /et
|
Line 60 This script will modify /etc/my.cnf, /et
|
/etc/mysql/mariadb.conf.d/50-server.cnf, |
/etc/mysql/mariadb.conf.d/50-server.cnf, |
and /etc/yum.conf, /etc/yum.repos.d/loncapa.repo, |
and /etc/yum.conf, /etc/yum.repos.d/loncapa.repo, |
/etc/apt/sources.list, /etc/apt/sources.list.d/loncapa.list or |
/etc/apt/sources.list, /etc/apt/sources.list.d/loncapa.list or |
/etc/sysconfig/rhn/sources to ensure certain parameters are set properly. |
/etc/sysconfig/rhn/sources and /home/www/.inputrc to ensure |
|
certain parameters are set properly. |
|
|
The LON-CAPA yum repositories are added to /etc/yum.conf, |
The LON-CAPA yum repositories are added to /etc/yum.conf, |
/etc/yum.repos.d/loncapa.repo, or /etc/sysconfig/rhn/sources |
/etc/yum.repos.d/loncapa.repo, or /etc/sysconfig/rhn/sources |
Line 359 my $mysql_www_status =
|
Line 364 my $mysql_www_status =
|
key =>'password=', |
key =>'password=', |
value =>$loncapa_config->{'lonSqlAccess'}},]); |
value =>$loncapa_config->{'lonSqlAccess'}},]); |
|
|
|
my $needs_inputrc_check; |
|
if ($dist =~ /^debian(\d+)$/) { |
|
if ($1 >= 12) { |
|
$needs_inputrc_check = 1; |
|
} |
|
} elsif ($dist =~ /^ubuntu(\d+)$/) { |
|
if ($1 >= 22) { |
|
$needs_inputrc_check = 1; |
|
} |
|
} elsif ($dist =~ /^(?:rhes|oracle|alma|rocky|centos)(\d+)(?:|\-stream)$/) { |
|
if ($1 >= 9) { |
|
$needs_inputrc_check = 1; |
|
} |
|
} elsif ($dist =~ /^fedora(\d+)$/) { |
|
if ($1 >= 34) { |
|
$needs_inputrc_check = 1; |
|
} |
|
} |
|
|
|
if ($needs_inputrc_check) { |
|
my $bash_www_cnf = '/home/www/.inputrc'; |
|
if (!-e $bash_www_cnf) { |
|
system("touch $bash_www_cnf"); |
|
if (open(my $fh,'>',$bash_www_cnf)) { |
|
print $fh <<'END'; |
|
$if R |
|
set enable-bracketed-paste off |
|
$endif |
|
|
|
$if maxima |
|
set enable-bracketed-paste off |
|
$endif |
|
END |
|
close($fh); |
|
} else { |
|
warn "**** Error: could not open $bash_www_cnf to add 'set enable-bracketed-paste to off'"; |
|
} |
|
my $wwwuid = getpwnam('www'); |
|
my $wwwgid = getgrnam('www'); |
|
if ($wwwuid!=$<) { |
|
chown($wwwuid,$wwwgid,$bash_www_cnf); |
|
} |
|
} else { |
|
my (%bracketed_paste_on,%bracketed_paste_off,@preserve,$condition); |
|
$condition = ''; |
|
if (open(my $fh,'<',$bash_www_cnf)) { |
|
while (my $line=<$fh>) { |
|
chomp($line); |
|
if ($line =~ /^\$if\s+(\w+)\s*$/) { |
|
if ($1 eq 'R') { |
|
$condition = 'r'; |
|
} elsif ($1 eq 'maxima') { |
|
$condition = 'maxima'; |
|
} else { |
|
$condition = 'other'; |
|
} |
|
} elsif ($line =~ /^\$endif\s*$/) { |
|
$condition = ''; |
|
} |
|
if ($line =~ /^\s*set\s+enable\-bracketed\-paste\s+(off|on)\s*$/) { |
|
if ($1 eq 'off') { |
|
if ($condition ne '') { |
|
$bracketed_paste_off{$condition} = 1; |
|
} else { |
|
$bracketed_paste_off{all} = 1; |
|
} |
|
push(@preserve,$line); |
|
} else { |
|
if ($condition ne '') { |
|
$bracketed_paste_on{$condition} = 1; |
|
if (($condition eq 'r') || ($condition eq 'maxima')) { |
|
push(@preserve,' set enable-bracketed-paste off'); |
|
} else { |
|
push(@preserve,$line); |
|
} |
|
} else { |
|
$bracketed_paste_on{all} = 1; |
|
push(@preserve,$line); |
|
} |
|
} |
|
} else { |
|
push(@preserve,$line); |
|
} |
|
} |
|
close($fh); |
|
} |
|
if (($bracketed_paste_on{r} || $bracketed_paste_on{maxima}) || |
|
(!exists($bracketed_paste_off{r}) && !exists($bracketed_paste_on{r}) && |
|
!exists($bracketed_paste_off{maxima}) && !exists($bracketed_paste_on{maxima}))) { |
|
if (open(my $fh,'>',$bash_www_cnf)) { |
|
if (@preserve) { |
|
foreach my $entry (@preserve) { |
|
print $fh "$entry\n"; |
|
} |
|
if (!exists($bracketed_paste_off{r}) && !exists($bracketed_paste_on{r})) { |
|
print $fh <<'END'; |
|
$if R |
|
set enable-bracketed-paste off |
|
$endif |
|
END |
|
} |
|
if (!exists($bracketed_paste_off{r}) && !exists($bracketed_paste_on{r})) { |
|
print $fh <<'END'; |
|
$if maxima |
|
set enable-bracketed-paste off |
|
$endif |
|
END |
|
} |
|
} else { |
|
print $fh <<'END'; |
|
$if R |
|
set enable-bracketed-paste off |
|
$endif |
|
|
|
$if maxima |
|
set enable-bracketed-paste off |
|
$endif |
|
END |
|
} |
|
close($fh); |
|
} else { |
|
warn "**** Error: could not open $bash_www_cnf to add 'set enable-bracketed-paste to off'"; |
|
} |
|
} |
|
} |
|
} |
|
|
my $exitvalue = 0; |
my $exitvalue = 0; |
|
|
if ($mysql_global_status) { $exitvalue = 1; } |
if ($mysql_global_status) { $exitvalue = 1; } |