--- doc/install/linux/install.pl 2011/05/05 16:38:07 1.11 +++ doc/install/linux/install.pl 2011/05/08 13:20:03 1.12 @@ -72,7 +72,7 @@ if (!open(LOG,">>loncapa_install.log")) &mt('Stopping execution.')."\n"; exit; } else { - print LOG '$Id: install.pl,v 1.11 2011/05/05 16:38:07 raeburn Exp $'."\n"; + print LOG '$Id: install.pl,v 1.12 2011/05/08 13:20:03 raeburn Exp $'."\n"; } # @@ -219,7 +219,7 @@ sub get_distro { } } elsif ($versionstring =~ /^SuSE Linux ([\d\.]+) /i) { $distro = 'suse'.$1; - $updatecmd = 'yast -i LONCAPA-preprequisites'; + $updatecmd = 'yast -i LONCAPA-prerequisites'; } elsif ($versionstring =~ /^openSUSE ([\d\.]+) /i) { $distro = 'suse'.$1; if ($1 >= 10.3 ) { @@ -425,21 +425,31 @@ sub check_mysql_running { print_and_log(&mt('MySQL is running.')."\n"); return 1; } else { - system("/etc/rc.d/init.d/$mysqldaemon start"); + system("/etc/init.d/$mysqldaemon start >/dev/null 2>&1 "); print_and_log(&mt('Waiting for MySQL to start.')."\n"); sleep 5; - if (open (PIPE, "/etc/init.d/$mysqldaemon 2>&1 |")) { - my $status = ; + if (open(PIPE,"ps -ef |grep $process |grep -v grep 2>&1 |")) { + $status = ; close(PIPE); chomp($status); - if ($status =~ /\(pid\s+\d\)/) { + if ($status =~ /^\Q$proc_owner\E\s+\d+\s+/) { print_and_log(&mt('MySQL is running.')."\n"); return 1; } else { - print_and_log(&mt('Unable to start MySQL.')."\n"); + print_and_log(&mt('Still waiting for MySQL to start.')."\n"); + sleep 5; + if (open(PIPE,"ps -ef |grep $process |grep -v grep 2>&1 |")) { + $status = ; + close(PIPE); + chomp($status); + if ($status =~ /^\Q$proc_owner\E\s+\d+\s+/) { + print_and_log(&mt('MySQL is running.')."\n"); + return 1; + } else { + print_and_log(&mt('Given up waiting for MySQL to start.')."\n"); + } + } } - } else { - print_and_log(&mt('Unable to start MySQL.')."\n"); } } } else { @@ -678,8 +688,12 @@ sub chksrvcs { chomp($daemonrunning); close(PIPE); if ($daemonrunning) { - if ($service eq 'memcached') { - unless ($daemonrunning =~ m{^www[^/]+\Q/usr/sbin/memcached -m 400 -v\E$}) { + if ($service eq 'memcached') { + my $cmd = '/usr/sbin/memcached'; + if ($distro =~ /^centos|fedora|scientific|rhes/) { + $cmd = '/usr/bin/memcached'; + } + unless ($daemonrunning =~ m{^www[^/]+\Q$cmd -m 400 -v\E$}) { $stopsrvcs{$service} = 1; } } else { @@ -823,7 +837,8 @@ sub check_mysql_setup { sub check_mysql_wwwuser { my $mysql_wwwuser; - my $dbhn = DBI->connect("DBI:mysql:database=information_schema",'www','localhostkey'); + my $dbhn = DBI->connect("DBI:mysql:database=information_schema",'www','localhostkey', + {PrintError => +0}) || return; if ($dbhn) { $mysql_wwwuser = 1; $dbhn->disconnect; @@ -1092,7 +1107,7 @@ if ($localecmd ne '') { exit; } if (!$gotprereqs) { - print "\n".&mt('The LONCAPA-prequisites package is not installed.')."\n". + print "\n".&mt('The LONCAPA-prerequisites package is not installed.')."\n". &mt('The following command can be used to install the package (and dependencies):')."\n\n". $updatecmd."\n\n"; if ($installnow eq '') { @@ -1106,7 +1121,7 @@ if (!$gotprereqs) { close(PIPE); $gotprereqs = &check_prerequisites($packagecmd,$distro); if (!$gotprereqs) { - print &mt('The LONCAPA-prequisites package is not installed.')."\n". + print &mt('The LONCAPA-prerequisites package is not installed.')."\n". &mt('Stopping execution.')."\n"; exit; } else { @@ -1116,7 +1131,7 @@ if (!$gotprereqs) { &check_required($instdir,$dsn); } } else { - print &mt('Failed to run command to install LONCAPA-prequisites')."\n"; + print &mt('Failed to run command to install LONCAPA-prerequisites')."\n"; exit; } } else { @@ -1461,7 +1476,7 @@ ENDPATCH ## Compile patched pwauth ## print_and_log(&mt('Compiling pwauth')."\n"); - my $result = `cd $dir/; make`; + my $result = `cd $dir/; make 2>/dev/null `; my $expected = <<"END"; gcc -g -c -o pwauth.o pwauth.c gcc -o pwauth -g pwauth.o -lcrypt @@ -1510,16 +1525,24 @@ sub kill_extra_services { if (($distro =~ /^ubuntu/) && ($version <= 8)) { $daemon = 'cupsys'; } - } elsif ($distro =~ /^(?:suse|sles|scientific)/) { + } else { $daemon = 'cups'; } } - &print_and_log(`/etc/init.d/$daemon stop`); + my $cmd = "ps -ef |grep '$daemon' |grep -v grep"; + if (open(PIPE,'-|',$cmd)) { + my $daemonrunning = ; + chomp($daemonrunning); + close(PIPE); + if ($daemonrunning) { + &print_and_log(`/etc/init.d/$daemon stop`); + } + } &print_and_log(&mt('Removing [_1] from startup.',$service)."\n"); if ($distro =~ /^(debian|ubuntu)/) { &print_and_log(`update-rc.d -f $daemon remove`); } else { - &print_and_log(`chkconfig --del $service`); + &print_and_log(`/sbin/chkconfig --del $service`); } } }