* Setup: fixed not working install on openSUSE 12.2/3, because last line of output from "service (mysql|apache2) status" is empty

This commit is contained in:
Ralf Becker 2013-03-22 10:26:59 +00:00
parent 9425c1da14
commit 82a442b722

View File

@ -92,8 +92,9 @@ function set_distro_defaults($distro=null)
switch (($config['distro'] = $distro))
{
case 'suse':
$config['php'] = '/usr/bin/php5';
$config['pear'] = '/usr/bin/pear5';
// openSUSE 12.1+ no longer uses php5
if (file_exists('/usr/bin/php5')) $config['php'] = '/usr/bin/php5';
if (file_exists('/usr/bin/pear5')) $config['pear'] = '/usr/bin/pear5';
$config['start_db'] = '/sbin/service mysql';
$config['autostart_db'] = '/sbin/chkconfig --level 345 mysql on';
$config['start_webserver'] = '/sbin/service apache2';
@ -230,7 +231,7 @@ foreach(array('php','source_dir','data_dir','setup-cli') as $name)
{
if (!file_exists($config[$name])) bail_out(1,$config[$name].' not found!');
}
$setup_cli = $config['php'].' -d memory_limit=265M '.$config['setup-cli'];
$setup_cli = $config['php'].' -d memory_limit=256M '.$config['setup-cli'];
if (!file_exists($config['header']) || filesize($config['header']) < 200) // default header redirecting to setup is 147 bytes
{
@ -240,7 +241,8 @@ if (!file_exists($config['header']) || filesize($config['header']) < 200) // def
// check for localhost if database server is started and start it (permanent) if not
if ($config['db_host'] == 'localhost' && $config['start_db'])
{
if (exec($config['start_db'].' status',$dummy,$ret) && $ret)
exec($config['start_db'].' status',$dummy,$ret);
if ($ret)
{
system($config['start_db'].' start');
system($config['autostart_db']);
@ -324,7 +326,8 @@ if (!file_exists($config['header']) || filesize($config['header']) < 200) // def
// check if webserver is started and start it (permanent) if not
if ($config['start_webserver'])
{
if (exec($config['start_webserver'].' status',$dummy,$ret) && $ret)
exec($config['start_webserver'].' status',$dummy,$ret);
if ($ret)
{
system($config['start_webserver'].' start');
system($config['autostart_webserver']);
@ -393,6 +396,10 @@ else
// fix egw_cache evtl. created by root, stoping webserver from accessing it
fix_perms();
// restart running Apache, to force APC to update changed sources and/or Apache configuration
$output = array();
run_cmd($config['start_webserver'].' status && '.$config['start_webserver'].' restart', $output, true);
exit($ret);
}
@ -426,7 +433,7 @@ function patch_header($filename,&$user,$password)
*
* @param string $cmd
* @param array &$output=null $output of command
* @param int|array $no_bailout=null exit code(s) to NOT bail out
* @param int|array|true $no_bailout=null exit code(s) to NOT bail out, or true to never bail out
* @return int exit code of $cmd
*/
function run_cmd($cmd,array &$output=null,$no_bailout=null)
@ -443,7 +450,7 @@ function run_cmd($cmd,array &$output=null,$no_bailout=null)
$output[] = $cmd;
exec($cmd,$output,$ret);
}
if ($ret && !in_array($ret,(array)$no_bailout))
if ($ret && $no_bailout !== true && !in_array($ret,(array)$no_bailout))
{
bail_out($ret,$verbose?null:$output);
}