minor fixes in installation process

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-08-20 11:21:49 +02:00
parent 2c9b2c1d67
commit 07094f231a
3 changed files with 16 additions and 9 deletions

View File

@@ -57,13 +57,17 @@ final class InstallCommand extends Command
{ {
$result = self::SUCCESS; $result = self::SUCCESS;
if ($input->getOption('create-userdata-from-str') !== false) { if ($input->getOption('create-userdata-from-str') !== null) {
$ud_str = $input->getOption('create-userdata-from-str'); $ud_str = $input->getOption('create-userdata-from-str');
$ud_dec = json_decode(base64_decode($ud_str), true); $ud_dec = @json_decode(@base64_decode($ud_str), true);
if (is_array($ud_dec) && !empty($ud_dec) && count($ud_dec) == 8) {
$core = new Core($ud_dec); $core = new Core($ud_dec);
$core->createUserdataConf(); $core->createUserdataConf();
return $result; return $result;
} }
$output->writeln("<error>Invalid parameter value.</>");
return self::INVALID;
}
session_start(); session_start();
@@ -130,6 +134,7 @@ final class InstallCommand extends Command
$this->io->info('Running unattended installation'); $this->io->info('Running unattended installation');
} else { } else {
$extended = $this->io->confirm('Use advanced installation mode?', false); $extended = $this->io->confirm('Use advanced installation mode?', false);
$decoded_input = [];
} }
$result = $this->showStep(0, $extended, $decoded_input); $result = $this->showStep(0, $extended, $decoded_input);
@@ -246,7 +251,7 @@ final class InstallCommand extends Command
if ($step == 3) { if ($step == 3) {
// do actual install with data from $this->formfielddata // do actual install with data from $this->formfielddata
$core = new Core($this->formfielddata); $core = new Core($this->formfielddata);
$core->doInstall(); $core->doInstall(false);
$core->createUserdataConf(); $core->createUserdataConf();
} }
return $this->showStep(++$step, $extended, $decoded_input); return $this->showStep(++$step, $extended, $decoded_input);

View File

@@ -52,7 +52,7 @@ class Core
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
public function doInstall() public function doInstall(bool $create_ud_str = true)
{ {
$options = [ $options = [
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8' 'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8'
@@ -116,8 +116,10 @@ class Core
$this->doDataEntries($pdo); $this->doDataEntries($pdo);
// create JSON array for config-services // create JSON array for config-services
$this->createJsonArray(); $this->createJsonArray();
if ($create_ud_str) {
$this->createUserdataParamStr(); $this->createUserdataParamStr();
} }
}
public function getUnprivilegedPdo(): PDO public function getUnprivilegedPdo(): PDO
{ {

View File

@@ -220,7 +220,7 @@ return [
'system' => [ 'system' => [
'label' => lng('install.install.runcmd'), 'label' => lng('install.install.runcmd'),
'type' => 'textarea', 'type' => 'textarea',
'value' => (!empty($_SESSION['installation']['ud_str']) ? Froxlor::getInstallDir() . "bin/froxlor-cli froxlor:install -c '" . $_SESSION['installation']['ud_str'] . "'" : "something went wrong...") . "\n" . 'value' => (!empty($_SESSION['installation']['ud_str']) ? Froxlor::getInstallDir() . "bin/froxlor-cli froxlor:install -c '" . $_SESSION['installation']['ud_str'] . "'\n" : "") .
(!empty($_SESSION['installation']['json_params']) ? Froxlor::getInstallDir() . "bin/froxlor-cli froxlor:config-services -a '" . $_SESSION['installation']['json_params'] . "' --yes-to-all" : "something went wrong..."), (!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' => 10, 'rows' => 10,