Commit bc04c3a5 authored by Till Brehm's avatar Till Brehm

- Added version detection for Ubuntu 14.10

- Fixed a problem with restart of services due to the fact that Ubuntu has upstart and systemd installed, but only upstart is working without errors.
parent 0e34bade
......@@ -86,6 +86,9 @@ function get_distname() {
$mainver = array_filter($mainver);
$mainver = current($mainver).'.'.next($mainver);
switch ($mainver){
case "14.10":
$relname = "(Utopic Unicorn)";
break;
case "14.04":
$relname = "(Trusty Tahr)";
break;
......
......@@ -2306,15 +2306,15 @@ class installer_base {
public function getinitcommand($servicename, $action, $init_script_directory = ''){
global $conf;
// systemd
if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){
return 'systemctl '.$action.' '.$servicename.'.service';
}
// upstart
if(is_executable('/sbin/initctl')){
exec('/sbin/initctl version 2>/dev/null | /bin/grep -q upstart', $retval['output'], $retval['retval']);
if(intval($retval['retval']) == 0) return 'service '.$servicename.' '.$action;
}
// systemd
if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){
return 'systemctl '.$action.' '.$servicename.'.service';
}
// sysvinit
if($init_script_directory == '') $init_script_directory = $conf['init_scripts'];
if(substr($init_script_directory, -1) === '/') $init_script_directory = substr($init_script_directory, 0, -1);
......
......@@ -62,6 +62,9 @@ class monitor_tools {
$mainver = array_filter($mainver);
$mainver = current($mainver).'.'.next($mainver);
switch ($mainver){
case "14.10":
$relname = "(Utopic Unicorn)";
break;
case "14.04":
$relname = "(Trusty Tahr)";
break;
......
......@@ -1721,15 +1721,15 @@ class system{
function getinitcommand($servicename, $action, $init_script_directory = ''){
global $conf;
// systemd
if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){
return 'systemctl '.$action.' '.$servicename.'.service';
}
// upstart
if(is_executable('/sbin/initctl')){
exec('/sbin/initctl version 2>/dev/null | /bin/grep -q upstart', $retval['output'], $retval['retval']);
if(intval($retval['retval']) == 0) return 'service '.$servicename.' '.$action;
}
// systemd
if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){
return 'systemctl '.$action.' '.$servicename.'.service';
}
// sysvinit
if($init_script_directory == '') $init_script_directory = $conf['init_scripts'];
if(substr($init_script_directory, -1) === '/') $init_script_directory = substr($init_script_directory, 0, -1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment