fixes and adjustments (+ notes) to install (on gentoo)

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-05-06 16:23:11 +02:00
parent ac638041fa
commit 008cbc964f
6 changed files with 41 additions and 31 deletions

View File

@@ -49,6 +49,7 @@ if (!file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
} }
// check installation status // check installation status
// @fixme userdata.inc.php is created iun step3 so step4 is never shown
if (file_exists(dirname(__DIR__) . '/lib/userdata.inc.php')) { if (file_exists(dirname(__DIR__) . '/lib/userdata.inc.php')) {
http_response_code(404); http_response_code(404);
die(); die();

View File

@@ -289,7 +289,7 @@ final class ConfigServices extends CliCommand
$applyFile = $input->getOption('apply'); $applyFile = $input->getOption('apply');
// check if plain JSON // check if plain JSON
$decoded_config = json_decode($applyFile); $decoded_config = json_decode($applyFile, true);
$skipFileCheck = false; $skipFileCheck = false;
if (json_last_error() == JSON_ERROR_NONE) { if (json_last_error() == JSON_ERROR_NONE) {
$skipFileCheck = true; $skipFileCheck = true;

View File

@@ -354,15 +354,8 @@ class Install
); );
// read os-release // read os-release
if (@file_exists('/etc/os-release')) { if (@file_exists('/etc/os-release')) {
$os_dist_content = file_get_contents('/etc/os-release'); $os_dist = parse_ini_file('/etc/os-release', false);
$os_dist_arr = explode("\n", $os_dist_content); return strtolower($os_dist['VERSION_CODENAME'] ?? ($os_dist['ID'] ?? null));
$os_dist = [];
foreach ($os_dist_arr as $os_dist_line) {
if (empty(trim($os_dist_line))) continue;
$tmp = explode("=", $os_dist_line);
$os_dist[$tmp[0]] = str_replace('"', "", trim($tmp[1]));
}
return strtolower($os_dist['VERSION_CODENAME']);
} }
return null; return null;
} }

View File

@@ -265,6 +265,13 @@ class Core
*/ */
private function grantDbPrivilegesTo(&$db_root, $database, $username, $password, $access_host) private function grantDbPrivilegesTo(&$db_root, $database, $username, $password, $access_host)
{ {
if ($this->validatedData['mysql_force_create']) {
$drop_stmt = $db_root->prepare("DROP USER :username@:host");
$drop_stmt->execute([
"username" => $username,
"host" => $access_host
]);
}
if (version_compare($db_root->getAttribute(PDO::ATTR_SERVER_VERSION), '10.0.0', '>=')) { if (version_compare($db_root->getAttribute(PDO::ATTR_SERVER_VERSION), '10.0.0', '>=')) {
// mariadb compatibility // mariadb compatibility
// create user // create user
@@ -417,17 +424,26 @@ class Core
$this->updateSetting($upd_stmt, '1', 'phpfpm', 'enabled_ownvhost'); $this->updateSetting($upd_stmt, '1', 'phpfpm', 'enabled_ownvhost');
} elseif ($this->validatedData['webserver_backend'] == 'fcgid') { } elseif ($this->validatedData['webserver_backend'] == 'fcgid') {
$this->updateSetting($upd_stmt, '1', 'system', 'mod_fcgid'); $this->updateSetting($upd_stmt, '1', 'system', 'mod_fcgid');
$this->updateSetting($upd_stmt, '1', 'phpfpm', 'mod_fcgid_ownvhost'); $this->updateSetting($upd_stmt, '1', 'system', 'mod_fcgid_ownvhost');
} }
// check currently used php version and set values of fpm/fcgid accordingly // check currently used php version and set values of fpm/fcgid accordingly
if (defined('PHP_MAJOR_VERSION') && defined('PHP_MINOR_VERSION')) { if (defined('PHP_MAJOR_VERSION') && defined('PHP_MINOR_VERSION')) {
// php-fpm // @todo does not work for gentoo
$reload = "service php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-fpm restart"; if ($this->validatedData['distribution'] == 'gentoo') {
$config_dir = "/etc/php/" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "/fpm/pool.d/"; // php-fpm
$reload = "/etc/init.d/php-fpm restart";
$config_dir = "/etc/php/fpm-php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "/fpm.d/";
// fcgid
$binary = "/usr/bin/php-cgi";
} else {
// php-fpm
$reload = "service php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-fpm restart";
$config_dir = "/etc/php/" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "/fpm/pool.d/";
// fcgid
$binary = "/usr/bin/php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-cgi";
}
$db_user->query("UPDATE `" . TABLE_PANEL_FPMDAEMONS . "` SET `reload_cmd` = '" . $reload . "', `config_dir` = '" . $config_dir . "' WHERE `id` ='1';"); $db_user->query("UPDATE `" . TABLE_PANEL_FPMDAEMONS . "` SET `reload_cmd` = '" . $reload . "', `config_dir` = '" . $config_dir . "' WHERE `id` ='1';");
// fcgid
$binary = "/usr/bin/php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-cgi";
$db_user->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `binary` = '" . $binary . "';"); $db_user->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `binary` = '" . $binary . "';");
} }
@@ -611,7 +627,7 @@ class Core
private function createJsonArray() private function createJsonArray()
{ {
$system_params= ["cron","libnssextrausers","logrotate"]; $system_params = ["cron", "libnssextrausers", "logrotate"];
if ($this->validatedData['webserver_backend'] == 'php-fpm') { if ($this->validatedData['webserver_backend'] == 'php-fpm') {
$system_params[] = 'php-fpm'; $system_params[] = 'php-fpm';
} elseif ($this->validatedData['webserver_backend'] == 'fcgid') { } elseif ($this->validatedData['webserver_backend'] == 'fcgid') {

View File

@@ -1590,7 +1590,7 @@ root: root@<SERVERNAME>
title="Postfix 2 with dovecot"> title="Postfix 2 with dovecot">
<include>//service[@type='smtp']/general/commands[@index=1] <include>//service[@type='smtp']/general/commands[@index=1]
</include> </include>
<command><![CDATA[echo "mail-mta/postfix dovecot-sasl -sasl" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "mail-mta/postfix dovecot-sasl -sasl" >> /etc/portage/package.use/froxlor]]></command>
<include>//service[@type='smtp']/general/installs[@index=1] <include>//service[@type='smtp']/general/installs[@index=1]
</include> </include>
<include>//service[@type='smtp']/general/commands[@index=2] <include>//service[@type='smtp']/general/commands[@index=2]
@@ -1738,7 +1738,7 @@ dovecot unix - n n - - pipe
title="Postfix 3 with dovecot" default="true"> title="Postfix 3 with dovecot" default="true">
<include>//service[@type='smtp']/general/commands[@index=1] <include>//service[@type='smtp']/general/commands[@index=1]
</include> </include>
<command><![CDATA[echo "mail-mta/postfix dovecot-sasl -sasl" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "mail-mta/postfix dovecot-sasl -sasl" >> /etc/portage/package.use/froxlor]]></command>
<include>//service[@type='smtp']/general/installs[@index=1] <include>//service[@type='smtp']/general/installs[@index=1]
</include> </include>
<include>//service[@type='smtp']/general/commands[@index=2] <include>//service[@type='smtp']/general/commands[@index=2]
@@ -1891,7 +1891,7 @@ dovecot unix - n n - - pipe
title="Postfix 2 with courier"> title="Postfix 2 with courier">
<include>//service[@type='smtp']/general/commands[@index=1] <include>//service[@type='smtp']/general/commands[@index=1]
</include> </include>
<command><![CDATA[echo "mail-mta/postfix -dovecot-sasl sasl" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "mail-mta/postfix -dovecot-sasl sasl" >> /etc/portage/package.use/froxlor]]></command>
<include>//service[@type='smtp']/general/installs[@index=1] <include>//service[@type='smtp']/general/installs[@index=1]
</include> </include>
<include>//service[@type='smtp']/general/commands[@index=2] <include>//service[@type='smtp']/general/commands[@index=2]
@@ -2020,7 +2020,7 @@ sql_select: SELECT password_enc FROM mail_users WHERE username='%u@%r' OR email=
<!-- Dovecot --> <!-- Dovecot -->
<daemon name="dovecot" version="2" title="Dovecot" <daemon name="dovecot" version="2" title="Dovecot"
default="true"> default="true">
<command><![CDATA[echo "net-mail/dovecot mysql managesieve sieve" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "net-mail/dovecot mysql managesieve sieve" >> /etc/portage/package.use/froxlor]]></command>
<install><![CDATA[emerge net-mail/dovecot]]></install> <install><![CDATA[emerge net-mail/dovecot]]></install>
<file name="/etc/dovecot/dovecot.conf" chown="root:root" <file name="/etc/dovecot/dovecot.conf" chown="root:root"
chmod="0640" backup="true"> chmod="0640" backup="true">
@@ -3424,7 +3424,7 @@ MAILDIRPATH=.maildir
<service type="ftp" title="{{lng.admin.configfiles.ftp}}"> <service type="ftp" title="{{lng.admin.configfiles.ftp}}">
<!-- Proftpd --> <!-- Proftpd -->
<daemon name="proftpd" title="ProFTPd" default="true"> <daemon name="proftpd" title="ProFTPd" default="true">
<command><![CDATA[echo "net-ftp/proftpd mysql" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "net-ftp/proftpd mysql" >> /etc/portage/package.use/froxlor]]></command>
<install><![CDATA[emerge net-ftp/proftpd]]></install> <install><![CDATA[emerge net-ftp/proftpd]]></install>
<file name="/etc/proftpd/create-cert.sh" chown="root:0" <file name="/etc/proftpd/create-cert.sh" chown="root:0"
chmod="0700"> chmod="0700">
@@ -3556,7 +3556,7 @@ UseReverseDNS off
</daemon> </daemon>
<!-- Pureftpd --> <!-- Pureftpd -->
<daemon name="pureftpd" title="PureFTPd"> <daemon name="pureftpd" title="PureFTPd">
<command><![CDATA[echo "net-ftp/pure-ftpd mysql" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "net-ftp/pure-ftpd mysql" >> /etc/portage/package.use/froxlor]]></command>
<install><![CDATA[emerge net-ftp/pure-ftpd]]></install> <install><![CDATA[emerge net-ftp/pure-ftpd]]></install>
<file name="/etc/conf.d/pure-ftpd" chown="root:0" chmod="0644" <file name="/etc/conf.d/pure-ftpd" chown="root:0" chmod="0644"
backup="true"> backup="true">
@@ -3610,7 +3610,7 @@ MySQLGetQTASZ SELECT panel_customers.diskspace/1024 AS QuotaSize FROM panel_cu
</daemon> </daemon>
<!-- Vsftpd --> <!-- Vsftpd -->
<daemon name="vsftpd" title="vsftpd"> <daemon name="vsftpd" title="vsftpd">
<command><![CDATA[echo "net-ftp/vsftpd pam" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "net-ftp/vsftpd pam" >> /etc/portage/package.use/froxlor]]></command>
<install><![CDATA[emerge net-ftp/vsftpd sys-auth/pam_mysql]]></install> <install><![CDATA[emerge net-ftp/vsftpd sys-auth/pam_mysql]]></install>
<file name="/etc/vsftpd/vsftpd.conf" chown="root:root" <file name="/etc/vsftpd/vsftpd.conf" chown="root:root"
chmod="0644" backup="true"> chmod="0644" backup="true">
@@ -3857,12 +3857,12 @@ aliases: files
</daemon> </daemon>
<!-- FCGID --> <!-- FCGID -->
<daemon name="fcgid" title="FCGID"> <daemon name="fcgid" title="FCGID">
<command><![CDATA[echo "dev-lang/php cgi" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "dev-lang/php cgi" >> /etc/portage/package.use/froxlor]]></command>
<install><![CDATA[emerge dev-lang/php sys-auth/libnss-mysql]]></install> <install><![CDATA[emerge dev-lang/php]]></install>
<commands index="1"> <commands index="1">
<visibility mode="equals" value="apache2">{{settings.system.webserver}} <visibility mode="equals" value="apache2">{{settings.system.webserver}}
</visibility> </visibility>
<command><![CDATA[echo "www-servers/apache suexec" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "www-servers/apache suexec" >> /etc/portage/package.use/froxlor]]></command>
</commands> </commands>
<install> <install>
<visibility mode="equals" value="apache2">{{settings.system.webserver}} <visibility mode="equals" value="apache2">{{settings.system.webserver}}
@@ -3894,12 +3894,12 @@ aliases: files
<!-- PHP-FPM --> <!-- PHP-FPM -->
<daemon name="php-fpm" <daemon name="php-fpm"
title="PHP-FPM"> title="PHP-FPM">
<command><![CDATA[echo "dev-lang/php fpm" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "dev-lang/php fpm" >> /etc/portage/package.use/froxlor]]></command>
<install><![CDATA[emerge dev-lang/php sys-auth/libnss-mysql]]></install> <install><![CDATA[emerge dev-lang/php]]></install>
<commands index="1"> <commands index="1">
<visibility mode="equals" value="apache2">{{settings.system.webserver}} <visibility mode="equals" value="apache2">{{settings.system.webserver}}
</visibility> </visibility>
<command><![CDATA[echo "www-servers/apache suexec" >> /etc/portage/package.use]]></command> <command><![CDATA[echo "www-servers/apache suexec" >> /etc/portage/package.use/froxlor]]></command>
</commands> </commands>
<install> <install>
<visibility mode="equals" value="apache2">{{settings.system.webserver}} <visibility mode="equals" value="apache2">{{settings.system.webserver}}

View File

@@ -212,7 +212,7 @@ return [
'system' => [ 'system' => [
'label' => lng('install.install.runcmd'), 'label' => lng('install.install.runcmd'),
'type' => 'textarea', 'type' => 'textarea',
'value' => !empty($_SESSION['installation']['json_params']) ? Froxlor::getInstallDir() . 'bin/froxlor-cli froxlor:config-services -a "' . $_SESSION['installation']['json_params'] . '" --yes-to-all' : 'something went wrong...', 'value' => !empty($_SESSION['installation']['json_params']) ? Froxlor::getInstallDir() . "bin/froxlor-cli froxlor:config-services -a '" . $_SESSION['installation']['json_params'] . "' --yes-to-all" : "something went wrong...",
'readonly' => true, 'readonly' => true,
'rows' => 1 'rows' => 1
], ],