add os distribution detection
This commit is contained in:
@@ -159,6 +159,7 @@ class FroxlorInstall
|
|||||||
$this->_guessServerName();
|
$this->_guessServerName();
|
||||||
$this->_guessServerIP();
|
$this->_guessServerIP();
|
||||||
$this->_guessWebserver();
|
$this->_guessWebserver();
|
||||||
|
$this->_guessDistribution();
|
||||||
|
|
||||||
$this->_getPostField('mysql_host', '127.0.0.1');
|
$this->_getPostField('mysql_host', '127.0.0.1');
|
||||||
$this->_getPostField('mysql_database', 'froxlor');
|
$this->_getPostField('mysql_database', 'froxlor');
|
||||||
@@ -840,6 +841,20 @@ class FroxlorInstall
|
|||||||
*/
|
*/
|
||||||
$section = $this->_lng['install']['serversettings'];
|
$section = $this->_lng['install']['serversettings'];
|
||||||
eval("\$formdata .= \"" . $this->_getTemplate("datasection") . "\";");
|
eval("\$formdata .= \"" . $this->_getTemplate("datasection") . "\";");
|
||||||
|
// distribution
|
||||||
|
if (! empty($_POST['installstep']) && $this->_data['distribution'] == '') {
|
||||||
|
$diststyle = 'color:red;';
|
||||||
|
} else {
|
||||||
|
$diststyle = '';
|
||||||
|
}
|
||||||
|
$formdata .= $this->_GETsectionItemCheckbox('distribution', 'jessie', ($this->_data['distribution'] == 'jessie'), $diststyle);
|
||||||
|
$formdata .= $this->_getSectionItemCheckbox('distribution', 'stretch', ($this->_data['distribution'] == 'stretch'), $diststyle);
|
||||||
|
$formdata .= $this->_getSectionItemCheckbox('distribution', 'buster', ($this->_data['distribution'] == 'buster'), $diststyle);
|
||||||
|
$formdata .= $this->_getSectionItemCheckbox('distribution', 'xenial', ($this->_data['distribution'] == 'xenial'), $diststyle);
|
||||||
|
$formdata .= $this->_getSectionItemCheckbox('distribution', 'bionic', ($this->_data['distribution'] == 'bionic'), $diststyle);
|
||||||
|
$formdata .= $this->_getSectionItemCheckbox('distribution', 'focal', ($this->_data['distribution'] == 'focal'), $diststyle);
|
||||||
|
$formdata .= $this->_getSectionItemCheckbox('distribution', 'rhel7', ($this->_data['distribution'] == 'rhel7'), $diststyle);
|
||||||
|
$formdata .= $this->_getSectionItemCheckbox('distribution', 'rhel8', ($this->_data['distribution'] == 'rhel8'), $diststyle);
|
||||||
// servername
|
// servername
|
||||||
if (! empty($_POST['installstep']) && $this->_data['servername'] == '') {
|
if (! empty($_POST['installstep']) && $this->_data['servername'] == '') {
|
||||||
$style = 'color:red;';
|
$style = 'color:red;';
|
||||||
@@ -861,12 +876,12 @@ class FroxlorInstall
|
|||||||
$websrvstyle = '';
|
$websrvstyle = '';
|
||||||
}
|
}
|
||||||
// apache
|
// apache
|
||||||
$formdata .= $this->_getSectionItemCheckbox('apache2', ($this->_data['webserver'] == 'apache2'), $websrvstyle);
|
$formdata .= $this->_getSectionItemCheckbox('webserver', 'apache2', ($this->_data['webserver'] == 'apache2'), $websrvstyle);
|
||||||
$formdata .= $this->_getSectionItemCheckbox('apache24', ($this->_data['webserver'] == 'apache24'), $websrvstyle);
|
$formdata .= $this->_getSectionItemCheckbox('webserver', 'apache24', ($this->_data['webserver'] == 'apache24'), $websrvstyle);
|
||||||
// lighttpd
|
// lighttpd
|
||||||
$formdata .= $this->_getSectionItemCheckbox('lighttpd', ($this->_data['webserver'] == 'lighttpd'), $websrvstyle);
|
$formdata .= $this->_getSectionItemCheckbox('webserver', 'lighttpd', ($this->_data['webserver'] == 'lighttpd'), $websrvstyle);
|
||||||
// nginx
|
// nginx
|
||||||
$formdata .= $this->_getSectionItemCheckbox('nginx', ($this->_data['webserver'] == 'nginx'), $websrvstyle);
|
$formdata .= $this->_getSectionItemCheckbox('webserver', 'NGINx', ($this->_data['webserver'] == 'nginx'), $websrvstyle);
|
||||||
// webserver-user
|
// webserver-user
|
||||||
if (! empty($_POST['installstep']) && $this->_data['httpuser'] == '') {
|
if (! empty($_POST['installstep']) && $this->_data['httpuser'] == '') {
|
||||||
$style = 'color:red;';
|
$style = 'color:red;';
|
||||||
@@ -918,7 +933,7 @@ class FroxlorInstall
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate form radio field for webserver-selection
|
* generate form radio field
|
||||||
*
|
*
|
||||||
* @param string $fieldname
|
* @param string $fieldname
|
||||||
* @param boolean $checked
|
* @param boolean $checked
|
||||||
@@ -926,8 +941,9 @@ class FroxlorInstall
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function _getSectionItemCheckbox($fieldname = null, $checked = false, $style = "")
|
private function _getSectionItemCheckbox($groupname = null, $fieldname = null, $checked = false, $style = "")
|
||||||
{
|
{
|
||||||
|
$groupname = $this->_lng['install'][$groupname];
|
||||||
$fieldlabel = $this->_lng['install'][$fieldname];
|
$fieldlabel = $this->_lng['install'][$fieldname];
|
||||||
if ($checked) {
|
if ($checked) {
|
||||||
$checked = 'checked="checked"';
|
$checked = 'checked="checked"';
|
||||||
@@ -1273,6 +1289,48 @@ class FroxlorInstall
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get/guess linux distribution
|
||||||
|
*/
|
||||||
|
private function _guessDistribution()
|
||||||
|
{
|
||||||
|
// post
|
||||||
|
if (! empty($_POST['distribution'])) {
|
||||||
|
$this->_data['distribution'] = $_POST['distribution'];
|
||||||
|
} else {
|
||||||
|
$os_version = parse_ini_file('/etc/os-release', false);
|
||||||
|
if ($os_version['ID'] == 'debian') {
|
||||||
|
|
||||||
|
} elseif ($os_version['ID'] == 'debian') {
|
||||||
|
if(explode('.',$os_version['VERSION_ID'])[0] == '8') {
|
||||||
|
$this->_data['distribution'] = 'jessie';
|
||||||
|
} elseif(explode('.',$os_version['VERSION_ID'])[0] == '9') {
|
||||||
|
$this->_data['distribution'] = 'stretch';
|
||||||
|
} elseif(explode('.',$os_version['VERSION_ID'])[0] == '10') {
|
||||||
|
$this->_data['distribution'] = 'buster';
|
||||||
|
}
|
||||||
|
} elseif ($os_version['ID'] == 'ubuntu') {
|
||||||
|
if(explode('.',$os_version['VERSION_ID'])[0] == '16') {
|
||||||
|
$this->_data['distribution'] = 'xenial';
|
||||||
|
} elseif(explode('.',$os_version['VERSION_ID'])[0] == '18') {
|
||||||
|
$this->_data['distribution'] = 'bionic';
|
||||||
|
} elseif(explode('.',$os_version['VERSION_ID'])[0] == '20') {
|
||||||
|
$this->_data['distribution'] = 'focal';
|
||||||
|
}
|
||||||
|
} elseif($os_version['ID'] == 'rhel' || $os_version['ID'] == 'centos' || $os_version['ID'] == 'fedora') {
|
||||||
|
if(explode('.',$os_version['VERSION_ID'])[0] == '7') {
|
||||||
|
$this->_data['distribution'] = 'rhel7';
|
||||||
|
} elseif(explode('.',$os_version['VERSION_ID'])[0] == '8') {
|
||||||
|
$this->_data['distribution'] = 'rhel8';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// we don't need to bail out, since unknown does not affect any critical installation routines
|
||||||
|
$this->_data['distribution'] = 'unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if POST field is set and get value for the
|
* check if POST field is set and get value for the
|
||||||
* internal data array, if not set use either '' or $default if != null
|
* internal data array, if not set use either '' or $default if != null
|
||||||
|
|||||||
@@ -63,6 +63,15 @@ $lng['install']['admin_pass1'] = 'Administrator Password';
|
|||||||
$lng['install']['admin_pass2'] = 'Administrator-Password (confirm)';
|
$lng['install']['admin_pass2'] = 'Administrator-Password (confirm)';
|
||||||
$lng['install']['activate_newsfeed'] = 'Enable the official newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
|
$lng['install']['activate_newsfeed'] = 'Enable the official newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
|
||||||
$lng['install']['serversettings'] = 'Server settings';
|
$lng['install']['serversettings'] = 'Server settings';
|
||||||
|
$lng['install']['distribution'] = 'Distribution';
|
||||||
|
$lng['install']['jessie'] = 'Debian Jessie';
|
||||||
|
$lng['install']['stretch'] = 'Debian Stretch';
|
||||||
|
$lng['install']['buster'] = 'Debian Buster';
|
||||||
|
$lng['install']['xenial'] = 'Ubuntu Xenial';
|
||||||
|
$lng['install']['bionic'] = 'Ubuntu Bionic';
|
||||||
|
$lng['install']['focal'] = 'Ubuntu Focal';
|
||||||
|
$lng['install']['rhel7'] = 'RHEL 7';
|
||||||
|
$lng['install']['rhel8'] = 'RHEL 8';
|
||||||
$lng['install']['servername'] = 'Server name (FQDN, no ip-address)';
|
$lng['install']['servername'] = 'Server name (FQDN, no ip-address)';
|
||||||
$lng['install']['serverip'] = 'Server IP';
|
$lng['install']['serverip'] = 'Server IP';
|
||||||
$lng['install']['webserver'] = 'Webserver';
|
$lng['install']['webserver'] = 'Webserver';
|
||||||
|
|||||||
@@ -53,6 +53,15 @@ $lng['install']['admin_user'] = 'Nom d\'utilisateur administrateur';
|
|||||||
$lng['install']['admin_pass1'] = 'Mot de passe administrateur';
|
$lng['install']['admin_pass1'] = 'Mot de passe administrateur';
|
||||||
$lng['install']['admin_pass2'] = 'Mot de passe administrateur (confirmez)';
|
$lng['install']['admin_pass2'] = 'Mot de passe administrateur (confirmez)';
|
||||||
$lng['install']['serversettings'] = 'Réglages serveur';
|
$lng['install']['serversettings'] = 'Réglages serveur';
|
||||||
|
$lng['install']['distribution'] = 'Distribution';
|
||||||
|
$lng['install']['jessie'] = 'Debian Jessie';
|
||||||
|
$lng['install']['stretch'] = 'Debian Stretch';
|
||||||
|
$lng['install']['buster'] = 'Debian Buster';
|
||||||
|
$lng['install']['xenial'] = 'Ubuntu Xenial';
|
||||||
|
$lng['install']['bionic'] = 'Ubuntu Bionic';
|
||||||
|
$lng['install']['focal'] = 'Ubuntu Focal';
|
||||||
|
$lng['install']['rhel7'] = 'RHEL 7';
|
||||||
|
$lng['install']['rhel8'] = 'RHEL 8';
|
||||||
$lng['install']['servername'] = 'Nom du serveur (FQDN, pas d\'adresse IP)';
|
$lng['install']['servername'] = 'Nom du serveur (FQDN, pas d\'adresse IP)';
|
||||||
$lng['install']['serverip'] = 'Adresse IP du serveur';
|
$lng['install']['serverip'] = 'Adresse IP du serveur';
|
||||||
$lng['install']['webserver'] = 'Serveur Web';
|
$lng['install']['webserver'] = 'Serveur Web';
|
||||||
|
|||||||
@@ -63,6 +63,15 @@ $lng['install']['admin_pass1'] = 'Administrator-Passwort';
|
|||||||
$lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)';
|
$lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)';
|
||||||
$lng['install']['activate_newsfeed'] = 'Aktiviere das offizielle Newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
|
$lng['install']['activate_newsfeed'] = 'Aktiviere das offizielle Newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
|
||||||
$lng['install']['serversettings'] = 'Servereinstellungen';
|
$lng['install']['serversettings'] = 'Servereinstellungen';
|
||||||
|
$lng['install']['distribution'] = 'Verteilung';
|
||||||
|
$lng['install']['jessie'] = 'Debian Jessie';
|
||||||
|
$lng['install']['stretch'] = 'Debian Stretch';
|
||||||
|
$lng['install']['buster'] = 'Debian Buster';
|
||||||
|
$lng['install']['xenial'] = 'Ubuntu Xenial';
|
||||||
|
$lng['install']['bionic'] = 'Ubuntu Bionic';
|
||||||
|
$lng['install']['focal'] = 'Ubuntu Focal';
|
||||||
|
$lng['install']['rhel7'] = 'RHEL 7';
|
||||||
|
$lng['install']['rhel8'] = 'RHEL 8';
|
||||||
$lng['install']['servername'] = 'Servername (FQDN, keine IP-Adresse)';
|
$lng['install']['servername'] = 'Servername (FQDN, keine IP-Adresse)';
|
||||||
$lng['install']['serverip'] = 'Server-IP';
|
$lng['install']['serverip'] = 'Server-IP';
|
||||||
$lng['install']['webserver'] = 'Webserver';
|
$lng['install']['webserver'] = 'Webserver';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<p>
|
<p>
|
||||||
<label for="{$fieldname}" class="install-block {$style}">{$this->_lng['install']['webserver']} {$fieldlabel}:</label>
|
<label for="{$fieldname}" class="install-block {$style}">{$groupname} {$fieldlabel}:</label>
|
||||||
<input type="radio" name="webserver" id="{$fieldname}" value="{$fieldname}" {$checked} /><span>{$fieldlabel}</span>
|
<input type="radio" name="{$groupname}" id="{$fieldname}" value="{$fieldname}" {$checked} /><span>{$fieldlabel}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user