forked from extern/egroupware
changes for RHEL7
This commit is contained in:
parent
8c2599d03a
commit
d433c4f240
@ -146,7 +146,13 @@ function set_distro_defaults($distro=null)
|
|||||||
// fall through
|
// fall through
|
||||||
case 'rh':
|
case 'rh':
|
||||||
// some MySQL packages (mysql.com, MariaDB, ...) use "mysql" as service name instead of RH default "mysqld"
|
// some MySQL packages (mysql.com, MariaDB, ...) use "mysql" as service name instead of RH default "mysqld"
|
||||||
if (!file_exists('/etc/init.d/mysqld') && file_exists('/etc/init.d/mysql'))
|
if (file_exists('/usr/bin/systemctl')) // RHEL 7
|
||||||
|
{
|
||||||
|
$config['autostart_db'] = $config['autostart_webserver'] = '';
|
||||||
|
$config['start_db'] = '/usr/bin/systemctl %s mariadb';
|
||||||
|
$config['start_webserver'] = '/usr/bin/systemctl %s httpd';
|
||||||
|
}
|
||||||
|
elseif (!file_exists('/etc/init.d/mysqld') && file_exists('/etc/init.d/mysql'))
|
||||||
{
|
{
|
||||||
foreach(array('start_db','autostart_db') as $name)
|
foreach(array('start_db','autostart_db') as $name)
|
||||||
{
|
{
|
||||||
@ -255,11 +261,11 @@ if (!file_exists($config['header']) || filesize($config['header']) < 200) // def
|
|||||||
// check for localhost if database server is started and start it (permanent) if not
|
// check for localhost if database server is started and start it (permanent) if not
|
||||||
if ($config['db_host'] == 'localhost' && $config['start_db'])
|
if ($config['db_host'] == 'localhost' && $config['start_db'])
|
||||||
{
|
{
|
||||||
exec($config['start_db'].' status',$dummy,$ret);
|
exec(build_cmd('start_db', 'status'), $dummy, $ret);
|
||||||
if ($ret)
|
if ($ret)
|
||||||
{
|
{
|
||||||
system($config['start_db'].' start');
|
system(build_cmd('start_db', 'start'));
|
||||||
system($config['autostart_db']);
|
if (!empty($config['autostart_db'])) system($config['autostart_db']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// create database
|
// create database
|
||||||
@ -345,15 +351,15 @@ if (!file_exists($config['header']) || filesize($config['header']) < 200) // def
|
|||||||
// check if webserver is started and start it (permanent) if not
|
// check if webserver is started and start it (permanent) if not
|
||||||
if ($config['start_webserver'])
|
if ($config['start_webserver'])
|
||||||
{
|
{
|
||||||
exec($config['start_webserver'].' status',$dummy,$ret);
|
exec(build_cmd('start_webserver', 'status'),$dummy,$ret);
|
||||||
if ($ret)
|
if ($ret)
|
||||||
{
|
{
|
||||||
system($config['start_webserver'].' start');
|
system(build_cmd('start_webserver', 'start'));
|
||||||
system($config['autostart_webserver']);
|
if (!empty($config['autostart_webserver'])) system($config['autostart_webserver']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
system($config['start_webserver'].' reload');
|
system(build_cmd('start_webserver', 'reload'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fix egw_cache evtl. created by root, stoping webserver from accessing it
|
// fix egw_cache evtl. created by root, stoping webserver from accessing it
|
||||||
@ -413,11 +419,29 @@ else
|
|||||||
|
|
||||||
// restart running Apache, to force APC to update changed sources and/or Apache configuration
|
// restart running Apache, to force APC to update changed sources and/or Apache configuration
|
||||||
$output = array();
|
$output = array();
|
||||||
run_cmd($config['start_webserver'].' status && '.$config['start_webserver'].' restart', $output, true);
|
run_cmd(build_cmd('start_webserver', 'status').' && '.build_cmd('start_webserver', 'restart'), $output, true);
|
||||||
|
|
||||||
exit($ret);
|
exit($ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build command to execute
|
||||||
|
*
|
||||||
|
* @param string $cmd command or index into $config, which either incl. %s for arg or arg with be appended
|
||||||
|
* @param string $arg argument
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function build_cmd($cmd, $arg)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (isset($config[$cmd])) $cmd = $config[$cmd];
|
||||||
|
|
||||||
|
if (strpos($cmd, '%s')) return str_replace('%s', $arg, $cmd);
|
||||||
|
|
||||||
|
return $cmd.' '.$arg;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patches a given password (for header admin) into the EGroupware header.inc.php and returns the old one
|
* Patches a given password (for header admin) into the EGroupware header.inc.php and returns the old one
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user