-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fec0b9d
commit 59756d1
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
web/app/Installers/Server/Applications/DovecotInstaller.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Installers\Server\Applications; | ||
|
||
class DovecotInstaller | ||
{ | ||
public $rubyVersions = []; | ||
|
||
public $logFilePath = '/var/log/phyre/dovecot-installer.log'; | ||
|
||
public function setLogFilePath($path) | ||
{ | ||
$this->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 . ' &'); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters