Skip to content

Commit

Permalink
Deprecated Ubuntu 18.04
Browse files Browse the repository at this point in the history
  • Loading branch information
eppak committed Sep 17, 2021
1 parent bba34c9 commit 91bb473
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 8 deletions.
13 changes: 12 additions & 1 deletion app/Commands/CommonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Illuminate\Support\Facades\File;
use Sculptor\Services\Logs;
use Sculptor\Stages\Version;
use Illuminate\Support\Str;

trait CommonCommand
{
Expand Down Expand Up @@ -35,4 +35,15 @@ private function dump(): void
$this->info($logs);
}
}

private function deprecated(bool $deprecated): bool
{
if ($deprecated) {
$continue = Str::lower($this->ask('This version is deprecated and untested with newer version, continue? (yes/no)'));

return $continue == 'yes' || $continue == 'y';
}

return true;
}
}
1 change: 1 addition & 0 deletions app/Commands/ConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function handle(Configuration $configuration, Templates $templates): int
private function configuration(Configuration $configuration): void
{
$filename = getcwd() . '/' . APP_CONFIG_FILENAME;

if (File::exists($filename)) {
$this->warn("Customized configuration already exists {$filename}");

Expand Down
6 changes: 6 additions & 0 deletions app/Commands/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public function handle(Stages $stages): int
{
$this->preamble();

if (!$this->deprecated($stages->deprecated())) {
$this->warn("Operation cancelled");

return 1;
}

if (!$stages->run($this)) {

$this->error($stages->error());
Expand Down
6 changes: 6 additions & 0 deletions app/Commands/StageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public function handle(Stages $stages): int

$this->info("Run time taken {$this->elapsed()}");

if (!$this->deprecated($stages->deprecated())) {
$this->warn("Operation cancelled");

return 1;
}

if (!$done) {
$this->error("Error: {$stages->error()}");

Expand Down
11 changes: 11 additions & 0 deletions installer.yml.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
stages:
- Credentials # Mandatory do not remove
- Php
- NodeJs
- CheckServices

php_versions:
- 7.3
- 7.4

node_version: 14
1 change: 1 addition & 0 deletions src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

define('APP_PATH', '.installer');
define('APP_COMPATIBLE_VERSION', ['18.04' , '20.04']);
define('APP_DEPRECATED_VERSION', ['18.04']);
define('APP_COMPATIBLE_ARCH', ['x86_64']);
define('APP_PANEL_USER', 'sculptor');
define('APP_PANEL_DB', 'sculptor');
Expand Down
11 changes: 11 additions & 0 deletions src/Stages.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ private function compatible(): bool
return true;
}

public function deprecated(): bool
{
if (!$this->version->compatible(APP_DEPRECATED_VERSION, APP_COMPATIBLE_ARCH)) {
$this->error = 'This version of the operating system is deprecated';

return false;
}

return true;
}

/**
* @param Command|null $context
* @return bool
Expand Down
4 changes: 2 additions & 2 deletions src/Stages/V1804/Packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class Packages extends StageBase implements Stage
'sudo',
'ufw',
'git',
'unattended-upgrades',
'sysstat'
'unattended-upgrades',
'sysstat'
];

/**
Expand Down
9 changes: 4 additions & 5 deletions src/Stages/V1804/Sshd.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Exception;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\File;
use Sculptor\Contracts\Stage;
use Sculptor\Stages\Environment;
use Sculptor\Stages\StageBase;
Expand All @@ -28,20 +27,20 @@ public function run(Environment $env): bool
!$this->write(
'/etc/ssh/sshd_config',
$this->template('sshd.conf'),
'Cannot read configuration'
'Cannot read sshd configuration'
)
) {
return false;
}

if (!$this->restart('sshd')) {
$this->internal = 'Cannot restart service';

return false;
throw new Exception('Cannot restart service');
}

return true;
} catch (Exception $e) {
$this->internal = $e->getMessage();

Log::error($e->getMessage());

return false;
Expand Down

0 comments on commit 91bb473

Please sign in to comment.