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
No known key found for this signature in database
GPG Key ID: 08A83830520FCECB
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
// @fixme userdata.inc.php is created iun step3 so step4 is never shown
if (file_exists(dirname(__DIR__) . '/lib/userdata.inc.php')) {
http_response_code(404);
die();

View File

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

View File

@ -354,15 +354,8 @@ class Install
);
// read os-release
if (@file_exists('/etc/os-release')) {
$os_dist_content = file_get_contents('/etc/os-release');
$os_dist_arr = explode("\n", $os_dist_content);
$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']);
$os_dist = parse_ini_file('/etc/os-release', false);
return strtolower($os_dist['VERSION_CODENAME'] ?? ($os_dist['ID'] ?? null));
}
return null;
}

View File

@ -265,6 +265,13 @@ class Core
*/
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', '>=')) {
// mariadb compatibility
// create user
@ -417,17 +424,26 @@ class Core
$this->updateSetting($upd_stmt, '1', 'phpfpm', 'enabled_ownvhost');
} elseif ($this->validatedData['webserver_backend'] == '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
if (defined('PHP_MAJOR_VERSION') && defined('PHP_MINOR_VERSION')) {
// 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/";
// @todo does not work for gentoo
if ($this->validatedData['distribution'] == 'gentoo') {
// 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';");
// fcgid
$binary = "/usr/bin/php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-cgi";
$db_user->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `binary` = '" . $binary . "';");
}
@ -611,7 +627,7 @@ class Core
private function createJsonArray()
{
$system_params= ["cron","libnssextrausers","logrotate"];
$system_params = ["cron", "libnssextrausers", "logrotate"];
if ($this->validatedData['webserver_backend'] == 'php-fpm') {
$system_params[] = 'php-fpm';
} elseif ($this->validatedData['webserver_backend'] == 'fcgid') {

View File

@ -1590,7 +1590,7 @@ root: root@<SERVERNAME>
title="Postfix 2 with dovecot">
<include>//service[@type='smtp']/general/commands[@index=1]
</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>
<include>//service[@type='smtp']/general/commands[@index=2]
@ -1738,7 +1738,7 @@ dovecot unix - n n - - pipe
title="Postfix 3 with dovecot" default="true">
<include>//service[@type='smtp']/general/commands[@index=1]
</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>
<include>//service[@type='smtp']/general/commands[@index=2]
@ -1891,7 +1891,7 @@ dovecot unix - n n - - pipe
title="Postfix 2 with courier">
<include>//service[@type='smtp']/general/commands[@index=1]
</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>
<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 -->
<daemon name="dovecot" version="2" title="Dovecot"
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>
<file name="/etc/dovecot/dovecot.conf" chown="root:root"
chmod="0640" backup="true">
@ -3424,7 +3424,7 @@ MAILDIRPATH=.maildir
<service type="ftp" title="{{lng.admin.configfiles.ftp}}">
<!-- Proftpd -->
<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>
<file name="/etc/proftpd/create-cert.sh" chown="root:0"
chmod="0700">
@ -3556,7 +3556,7 @@ UseReverseDNS off
</daemon>
<!-- 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>
<file name="/etc/conf.d/pure-ftpd" chown="root:0" chmod="0644"
backup="true">
@ -3610,7 +3610,7 @@ MySQLGetQTASZ SELECT panel_customers.diskspace/1024 AS QuotaSize FROM panel_cu
</daemon>
<!-- 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>
<file name="/etc/vsftpd/vsftpd.conf" chown="root:root"
chmod="0644" backup="true">
@ -3857,12 +3857,12 @@ aliases: files
</daemon>
<!-- FCGID -->
<daemon name="fcgid" title="FCGID">
<command><![CDATA[echo "dev-lang/php cgi" >> /etc/portage/package.use]]></command>
<install><![CDATA[emerge dev-lang/php sys-auth/libnss-mysql]]></install>
<command><![CDATA[echo "dev-lang/php cgi" >> /etc/portage/package.use/froxlor]]></command>
<install><![CDATA[emerge dev-lang/php]]></install>
<commands index="1">
<visibility mode="equals" value="apache2">{{settings.system.webserver}}
</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>
<install>
<visibility mode="equals" value="apache2">{{settings.system.webserver}}
@ -3894,12 +3894,12 @@ aliases: files
<!-- PHP-FPM -->
<daemon name="php-fpm"
title="PHP-FPM">
<command><![CDATA[echo "dev-lang/php fpm" >> /etc/portage/package.use]]></command>
<install><![CDATA[emerge dev-lang/php sys-auth/libnss-mysql]]></install>
<command><![CDATA[echo "dev-lang/php fpm" >> /etc/portage/package.use/froxlor]]></command>
<install><![CDATA[emerge dev-lang/php]]></install>
<commands index="1">
<visibility mode="equals" value="apache2">{{settings.system.webserver}}
</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>
<install>
<visibility mode="equals" value="apache2">{{settings.system.webserver}}

View File

@ -212,7 +212,7 @@ return [
'system' => [
'label' => lng('install.install.runcmd'),
'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,
'rows' => 1
],