diff --git a/web/app/Installers/Server/Applications/DovecotInstaller.php b/web/app/Installers/Server/Applications/DovecotInstaller.php new file mode 100644 index 0000000..11facdb --- /dev/null +++ b/web/app/Installers/Server/Applications/DovecotInstaller.php @@ -0,0 +1,37 @@ +logFilePath = $path; + } + + public function install() + { + + $commands = []; + $commands[] = 'echo "Installing dovecot..."'; + $commands[] = 'apt-get install -y dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd'; + + $shellFileContent = ''; + foreach ($commands as $command) { + $shellFileContent .= $command . PHP_EOL; + } + + $shellFileContent .= 'echo "All packages installed successfully!"' . PHP_EOL; + $shellFileContent .= 'echo "DONE!"' . PHP_EOL; + $shellFileContent .= 'rm -f /tmp/dovecot-installer.sh'; + + file_put_contents('/tmp/dovecot-installer.sh', $shellFileContent); + + shell_exec('bash /tmp/dovecot-installer.sh >> ' . $this->logFilePath . ' &'); + + } +} diff --git a/web/app/Livewire/Installer.php b/web/app/Livewire/Installer.php index cc5bd85..0c2b353 100644 --- a/web/app/Livewire/Installer.php +++ b/web/app/Livewire/Installer.php @@ -3,6 +3,7 @@ namespace App\Livewire; use App\Filament\Enums\ServerApplicationType; +use App\Installers\Server\Applications\DovecotInstaller; use App\Installers\Server\Applications\NodeJsInstaller; use App\Installers\Server\Applications\PHPInstaller; use App\Installers\Server\Applications\PythonInstaller; @@ -245,6 +246,21 @@ class Installer extends Page }), Wizard\Step::make('Step 3') + ->description('Configure your email server') + ->schema([ + + + + ])->afterValidation(function () { + + $dovecotInstaller = new DovecotInstaller(); + $dovecotInstaller->setLogFilePath(storage_path($this->install_log_file_path)); + $dovecotInstaller->install(); + + dd(storage_path($this->install_log_file_path)); + }), + + Wizard\Step::make('Step 4') ->description('Finish installation') ->schema([