version 1.12, 2011/05/08 13:20:03
|
version 1.21, 2011/07/21 21:28:33
|
Line 191 sub get_distro {
|
Line 191 sub get_distro {
|
$distro = 'rhes'.$1; |
$distro = 'rhes'.$1; |
$updatecmd = 'yum install LONCAPA-prerequisites'; |
$updatecmd = 'yum install LONCAPA-prerequisites'; |
$installnow = 'yum -y install LONCAPA-prerequisites'; |
$installnow = 'yum -y install LONCAPA-prerequisites'; |
} elsif ($versionstring =~ /CentOS release (\d+)/) { |
} elsif ($versionstring =~ /CentOS(?:| Linux) release (\d+)/) { |
$distro = 'centos'.$1; |
$distro = 'centos'.$1; |
$updatecmd = 'yum install LONCAPA-prerequisites'; |
$updatecmd = 'yum install LONCAPA-prerequisites'; |
$installnow = 'yum -y install LONCAPA-prerequisites'; |
$installnow = 'yum -y install LONCAPA-prerequisites'; |
Line 500 sub chkconfig {
|
Line 500 sub chkconfig {
|
my $nrlstr = join('',@norunlevels); |
my $nrlstr = join('',@norunlevels); |
foreach my $type ('apache','mysql','ntp','cups','memcached') { |
foreach my $type ('apache','mysql','ntp','cups','memcached') { |
my $service = $daemon{$type}; |
my $service = $daemon{$type}; |
|
if ($type eq 'ntp') { |
|
if ($distro =~ /^(?:fedora)(\d+)/) { |
|
my $version = $1; |
|
if ($version >= 15) { |
|
if (!-l "/etc/systemd/system/multi-user.target.wants/ntpd.service") { |
|
$needfix{$type} = 'systemctl enable ntpd.service'; |
|
} |
|
next; |
|
} |
|
} |
|
} |
my $command = $checker_bin.' --list '.$service.' 2>/dev/null'; |
my $command = $checker_bin.' --list '.$service.' 2>/dev/null'; |
if ($type eq 'cups') { |
if ($type eq 'cups') { |
if ($distro =~ /^(?:debian|ubuntu)(\d+)/) { |
if ($distro =~ /^(?:debian|ubuntu)(\d+)/) { |
Line 600 sub chkapache {
|
Line 611 sub chkapache {
|
my ($distro,$instdir) = @_; |
my ($distro,$instdir) = @_; |
my $fixapache = 1; |
my $fixapache = 1; |
if ($distro =~ /^(debian|ubuntu)/) { |
if ($distro =~ /^(debian|ubuntu)/) { |
if (!-e "$instdir/debian-ubuntu/apache2.conf") { |
if (!-e "$instdir/debian-ubuntu/loncapa") { |
$fixapache = 0; |
$fixapache = 0; |
print &mt('Warning: No LON-CAPA Apache configuration file found for installation check.')."\n"; |
print &mt('Warning: No LON-CAPA Apache configuration file found for installation check.')."\n"; |
} elsif ((-e "/etc/apache2/sites-available/loncapa") && (-e "$instdir/debian-ubuntu/apache2.conf")) { |
} elsif ((-e "/etc/apache2/sites-available/loncapa") && (-e "$instdir/debian-ubuntu/loncapa")) { |
if (open(PIPE, "diff --brief $instdir/debian-ubuntu/apache2.conf /etc/apache2/sites-available/loncapa |")) { |
if (open(PIPE, "diff --brief $instdir/debian-ubuntu/loncapa /etc/apache2/sites-available/loncapa |")) { |
my $diffres = <PIPE>; |
my $diffres = <PIPE>; |
close(PIPE); |
close(PIPE); |
chomp($diffres); |
chomp($diffres); |
Line 653 sub chkapache {
|
Line 664 sub chkapache {
|
} |
} |
} |
} |
} else { |
} else { |
if (!-e "$instdir/centos-rhes-fedora-sl/httpd.conf") { |
my $configfile = 'httpd.conf'; |
|
if ($distro =~ /^(?:centos|rhes|scientific)(\d+)$/) { |
|
if ($1 > 5) { |
|
$configfile = 'new/httpd.conf'; |
|
} |
|
} elsif ($distro =~ /^fedora(\d+)$/) { |
|
if ($1 > 10) { |
|
$configfile = 'new/httpd.conf'; |
|
} |
|
} |
|
if (!-e "$instdir/centos-rhes-fedora-sl/$configfile") { |
$fixapache = 0; |
$fixapache = 0; |
print &mt('Warning: No LON-CAPA Apache configuration file found for installation check.')."\n"; |
print &mt('Warning: No LON-CAPA Apache configuration file found for installation check.')."\n"; |
} elsif ((-e "/etc/httpd/conf/httpd.conf") && (-e "$instdir/centos-rhes-fedora-sl/httpd.conf")) { |
} elsif ((-e "/etc/httpd/conf/httpd.conf") && (-e "$instdir/centos-rhes-fedora-sl/$configfile")) { |
if (open(PIPE, "diff --brief $instdir/centos-rhes-fedora-sl/httpd.conf /etc/httpd/conf/httpd.conf |")) { |
if (open(PIPE, "diff --brief $instdir/centos-rhes-fedora-sl/$configfile /etc/httpd/conf/httpd.conf |")) { |
my $diffres = <PIPE>; |
my $diffres = <PIPE>; |
close(PIPE); |
close(PIPE); |
chomp($diffres); |
chomp($diffres); |
Line 689 sub chksrvcs {
|
Line 710 sub chksrvcs {
|
close(PIPE); |
close(PIPE); |
if ($daemonrunning) { |
if ($daemonrunning) { |
if ($service eq 'memcached') { |
if ($service eq 'memcached') { |
my $cmd = '/usr/sbin/memcached'; |
my $cmd = '/usr/bin/memcached'; |
if ($distro =~ /^centos|fedora|scientific|rhes/) { |
if ($distro =~ /^(suse|sles)/) { |
$cmd = '/usr/bin/memcached'; |
$cmd = '/usr/sbin/memcached'; |
} |
} |
unless ($daemonrunning =~ m{^www[^/]+\Q$cmd -m 400 -v\E$}) { |
unless ($daemonrunning =~ m{^www[^/]+\Q$cmd -m 400 -v\E$}) { |
$stopsrvcs{$service} = 1; |
$stopsrvcs{$service} = 1; |
} |
} |
Line 1201 if ($callsub{'download'}) {
|
Line 1222 if ($callsub{'download'}) {
|
print &mt('The most recent LON-CAPA release is version: [_1].',$production)."\n". |
print &mt('The most recent LON-CAPA release is version: [_1].',$production)."\n". |
&mt('Download the production release? ~[Y/n~]'); |
&mt('Download the production release? ~[Y/n~]'); |
if (&get_user_selection(1)) { |
if (&get_user_selection(1)) { |
$sourcetarball = $production.'tar.gz'; |
$sourcetarball = 'loncapa-'.$production.'.tar.gz'; |
} |
} |
} |
} |
} elsif ($filetouse ne '') { |
} elsif ($filetouse ne '') { |
Line 1255 if ($callsub{'apache'}) {
|
Line 1276 if ($callsub{'apache'}) {
|
} elsif ($distro =~ /^(debian|ubuntu)/) { |
} elsif ($distro =~ /^(debian|ubuntu)/) { |
©_apache2_debconf($instdir); |
©_apache2_debconf($instdir); |
} else { |
} else { |
©_httpd_conf($instdir); |
©_httpd_conf($instdir,$distro); |
} |
} |
} else { |
} else { |
print_and_log(&mt('Skipping configuration of Apache web server.')."\n"); |
print_and_log(&mt('Skipping configuration of Apache web server.')."\n"); |
Line 1559 sub setup_mysql {
|
Line 1580 sub setup_mysql {
|
} |
} |
push(@mysql_lc_commands,"USE loncapa"); |
push(@mysql_lc_commands,"USE loncapa"); |
push(@mysql_lc_commands,qq{ |
push(@mysql_lc_commands,qq{ |
CREATE TABLE IF NOT EXISTS metadata (title TEXT, author TEXT, subject TEXT, url TEXT, keywords TEXT, version TEXT, notes TEXT, abstract TEXT, mime TEXT, language TEXT, creationdate DATETIME, lastrevisiondate DATETIME, owner TEXT, copyright TEXT, FULLTEXT idx_title (title), FULLTEXT idx_author (author), FULLTEXT idx_subject (subject), FULLTEXT idx_url (url), FULLTEXT idx_keywords (keywords), FULLTEXT idx_version (version), FULLTEXT idx_notes (notes), FULLTEXT idx_abstract (abstract), FULLTEXT idx_mime (mime), FULLTEXT idx_language (language), FULLTEXT idx_owner (owner), FULLTEXT idx_copyright (copyright)) TYPE=MYISAM |
CREATE TABLE IF NOT EXISTS metadata (title TEXT, author TEXT, subject TEXT, url TEXT, keywords TEXT, version TEXT, notes TEXT, abstract TEXT, mime TEXT, language TEXT, creationdate DATETIME, lastrevisiondate DATETIME, owner TEXT, copyright TEXT, domain TEXT, dependencies TEXT, modifyinguser TEXT, authorspace TEXT, lowestgradelevel TEXT, highestgradelevel TEXT, standards TEXT, count INT, course INT, course_list TEXT, goto INT, goto_list TEXT, comefrom INT, comefrom_list TEXT, sequsage INT, sequsage_list TEXT, stdno INT, stdno_list TEXT, avetries FLOAT, avetries_list TEXT, difficulty FLOAT, difficulty_list TEXT, disc FLOAT, disc_list TEXT, clear FLOAT, technical FLOAT, correct FLOAT, helpful FLOAT, depth FLOAT, hostname TEXT, FULLTEXT idx_title (title), FULLTEXT idx_author (author), FULLTEXT idx_subject (subject), FULLTEXT idx_url (url), FULLTEXT idx_keywords (keywords), FULLTEXT idx_version (version), FULLTEXT idx_notes (notes), FULLTEXT idx_abstract (abstract), FULLTEXT idx_mime (mime), FULLTEXT idx_language (language), FULLTEXT idx_owner (owner), FULLTEXT idx_copyright (copyright)) ENGINE=MYISAM |
}); |
}); |
if ($setup_mysql_permissions) { |
if ($setup_mysql_permissions) { |
&setup_mysql_permissions($dbh,$has_pass,@mysql_lc_commands); |
&setup_mysql_permissions($dbh,$has_pass,@mysql_lc_commands); |
Line 1689 sub get_mysql_version {
|
Line 1710 sub get_mysql_version {
|
########################################################### |
########################################################### |
|
|
sub copy_httpd_conf { |
sub copy_httpd_conf { |
my ($instdir) = @_; |
my ($instdir,$distro) = @_; |
|
my $configfile = 'httpd.conf'; |
|
if ($distro =~ /^(?:centos|rhes|scientific)(\d+)$/) { |
|
if ($1 > 5) { |
|
$configfile = 'new/httpd.conf'; |
|
} |
|
} elsif ($distro =~ /^fedora(\d+)$/) { |
|
if ($1 > 10) { |
|
$configfile = 'new/httpd.conf'; |
|
} |
|
} |
print_and_log(&mt('Copying the LON-CAPA [_1] to [_2].',"'httpd.conf'", |
print_and_log(&mt('Copying the LON-CAPA [_1] to [_2].',"'httpd.conf'", |
"'/etc/httpd/conf/httpd.conf'")."\n"); |
"'/etc/httpd/conf/httpd.conf'")."\n"); |
copy "/etc/httpd/conf/httpd.conf","/etc/httpd/conf/httpd.conf.original"; |
copy "/etc/httpd/conf/httpd.conf","/etc/httpd/conf/httpd.conf.original"; |
copy "$instdir/centos-rhes-fedora-sl/httpd.conf","/etc/httpd/conf/httpd.conf"; |
copy "$instdir/centos-rhes-fedora-sl/$configfile","/etc/httpd/conf/httpd.conf"; |
chmod(0444,"/etc/httpd/conf/httpd.conf"); |
chmod(0444,"/etc/httpd/conf/httpd.conf"); |
print_and_log("\n"); |
print_and_log("\n"); |
} |
} |
|
|
######################################################### |
######################################################### |
## |
## |
## Ubuntu/Debian -- copy our apache2 configuration file to |
## Ubuntu/Debian -- copy our loncapa configuration file to |
## sites-available and set the symlink from sites-enabled. |
## sites-available and set the symlink from sites-enabled. |
## |
## |
######################################################### |
######################################################### |
Line 1716 sub copy_apache2_debconf {
|
Line 1747 sub copy_apache2_debconf {
|
if (-e "$apache2_sites_available_dir/loncapa") { |
if (-e "$apache2_sites_available_dir/loncapa") { |
copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original"); |
copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original"); |
} |
} |
copy("$instdir/debian-ubuntu/apache2.conf","$apache2_sites_available_dir/loncapa"); |
copy("$instdir/debian-ubuntu/loncapa","$apache2_sites_available_dir/loncapa"); |
chmod(0444,"$apache2_sites_available_dir/loncapa"); |
chmod(0444,"$apache2_sites_available_dir/loncapa"); |
symlink("$apache2_sites_available_dir/loncapa","$apache2_sites_enabled_dir/000-default"); |
symlink("$apache2_sites_available_dir/loncapa","$apache2_sites_enabled_dir/000-default"); |
my $apache2_mods_enabled_dir = '/etc/apache2/mods-enabled'; |
my $apache2_mods_enabled_dir = '/etc/apache2/mods-enabled'; |