diff --git a/actions/admin/settings/185.spf.php b/actions/admin/settings/185.spf.php
index 51d7b9a2..0a5fd16b 100644
--- a/actions/admin/settings/185.spf.php
+++ b/actions/admin/settings/185.spf.php
@@ -29,7 +29,7 @@ return [
'title' => lng('admin.spfsettings'),
'icon' => 'fa-solid fa-clipboard-check',
'fields' => [
- 'spf_enabled' => [
+ 'use_spf' => [
'label' => lng('spf.use_spf'),
'settinggroup' => 'spf',
'varname' => 'use_spf',
diff --git a/install/install.php b/install/install.php
index b0bded86..b585c1b6 100644
--- a/install/install.php
+++ b/install/install.php
@@ -51,10 +51,9 @@ 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();
+ header("Location: ../");
+ exit;
}
require dirname(__DIR__) . '/vendor/autoload.php';
diff --git a/lib/Froxlor/Cli/InstallCommand.php b/lib/Froxlor/Cli/InstallCommand.php
index 94858e0c..bfcc7721 100644
--- a/lib/Froxlor/Cli/InstallCommand.php
+++ b/lib/Froxlor/Cli/InstallCommand.php
@@ -49,13 +49,22 @@ final class InstallCommand extends Command
$this->setName('froxlor:install');
$this->setDescription('Installation process to use instead of web-ui');
$this->addArgument('input-file', InputArgument::OPTIONAL, 'Optional JSON array file to use for unattended installations');
- $this->addOption('print-example-file', 'p', InputOption::VALUE_NONE, 'Outputs an example JSON content to be used with the input file parameter');
+ $this->addOption('print-example-file', 'p', InputOption::VALUE_NONE, 'Outputs an example JSON content to be used with the input file parameter')
+ ->addOption('create-userdata-from-str', 'c', InputOption::VALUE_REQUIRED, 'Creates lib/userdata.inc.php file from string created by web-install process');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$result = self::SUCCESS;
+ if ($input->getOption('create-userdata-from-str') !== false) {
+ $ud_str = $input->getOption('create-userdata-from-str');
+ $ud_dec = json_decode(base64_decode($ud_str), true);
+ $core = new Core($ud_dec);
+ $core->createUserdataConf();
+ return $result;
+ }
+
session_start();
require __DIR__ . '/install.functions.php';
diff --git a/lib/Froxlor/Install/Install.php b/lib/Froxlor/Install/Install.php
index 07df0261..ff423d00 100644
--- a/lib/Froxlor/Install/Install.php
+++ b/lib/Froxlor/Install/Install.php
@@ -404,8 +404,20 @@ class Install
$default = 'bullseye';
// read os-release
- if (@file_exists('/etc/os-release')) {
- $os_dist = parse_ini_file('/etc/os-release', false);
+ if (@file_exists('/etc/os-release') && is_readable('/etc/os-release')) {
+ if (function_exists('parse_ini_file')) {
+ $os_dist = parse_ini_file('/etc/os-release', false);
+ } else {
+ $osrf = explode("\n", file_get_contents('/etc/os-release'));
+ foreach ($osrf as $line) {
+ $osrfline = explode("\n", $line);
+ if ($osrfline[0] == 'VERSION_CODENAME') {
+ $os_dist['VERSION_CODENAME'] = $osrfline[1];
+ } else if ($osrfline[0] == 'ID') {
+ $os_dist['ID'] = $osrfline[1];
+ }
+ }
+ }
return strtolower($os_dist['VERSION_CODENAME'] ?? ($os_dist['ID'] ?? $default));
}
return $default;
diff --git a/lib/Froxlor/Install/Install/Core.php b/lib/Froxlor/Install/Install/Core.php
index 9d65f55e..9ae7099a 100644
--- a/lib/Froxlor/Install/Install/Core.php
+++ b/lib/Froxlor/Install/Install/Core.php
@@ -116,6 +116,7 @@ class Core
$this->doDataEntries($pdo);
// create JSON array for config-services
$this->createJsonArray();
+ $this->createUserdataParamStr();
}
public function getUnprivilegedPdo(): PDO
@@ -675,4 +676,23 @@ class Core
];
$_SESSION['installation']['json_params'] = json_encode($json_params);
}
+
+ private function createUserdataParamStr()
+ {
+ $req_fields = [
+ 'mysql_host',
+ 'mysql_unprivileged_user',
+ 'mysql_unprivileged_pass',
+ 'mysql_database',
+ 'mysql_root_user',
+ 'mysql_root_pass',
+ 'mysql_ssl_ca_file',
+ 'mysql_ssl_verify_server_certificate'
+ ];
+ $json_params = [];
+ foreach ($req_fields as $field) {
+ $json_params[$field] = $this->validatedData[$field] ?? "";
+ }
+ $_SESSION['installation']['ud_str'] = base64_encode(json_encode($json_params));
+ }
}
diff --git a/lib/formfields/install/formfield.install.php b/lib/formfields/install/formfield.install.php
index dda57fbb..1d5d7f04 100644
--- a/lib/formfields/install/formfield.install.php
+++ b/lib/formfields/install/formfield.install.php
@@ -220,9 +220,11 @@ 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']['ud_str']) ? Froxlor::getInstallDir() . "bin/froxlor-cli froxlor:install -c '" . $_SESSION['installation']['ud_str'] . "'" : "something went wrong...") . "\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..."),
'readonly' => true,
- 'rows' => 3
+ 'rows' => 10,
+ 'style' => 'min-height:16rem;'
],
'manual_config' => [
'label' => lng('install.install.manual_config'),
diff --git a/templates/Froxlor/form/formfields.html.twig b/templates/Froxlor/form/formfields.html.twig
index 6c632df6..4151475e 100644
--- a/templates/Froxlor/form/formfields.html.twig
+++ b/templates/Froxlor/form/formfields.html.twig
@@ -201,7 +201,7 @@
{% endmacro %}
{% macro textarea(id, field) %}
-
+
{% endmacro %}
{% macro link(id, field) %}