Refactor the installation loop architecture
This commit is contained in:
parent
73c0648611
commit
467ad0caab
|
@ -29,8 +29,10 @@ function Start-InstallationLoop {
|
|||
. "$PSScriptRoot/../Scripts/SetupConfig.ps1";
|
||||
|
||||
while (-not (Get-IsFinished)) {
|
||||
switch (Get-Stage) {
|
||||
$null {
|
||||
if (-not (Get-Stage)) {
|
||||
Set-Stage [SetupStage]::Initialize;
|
||||
break;
|
||||
} elseif (Get-Stage -eq [SetupStage]::Initialize) {
|
||||
if (-not ((Get-Command "choco") -and (Get-Command "refreshenv"))) {
|
||||
Invoke-Hook "Install-Chocolatey" -Fallback {
|
||||
# Install chocolatey
|
||||
|
@ -53,10 +55,14 @@ function Start-InstallationLoop {
|
|||
if (Test-Path $env:PWSH_PATH) {
|
||||
Remove-Item -Recurse $env:PWSH_PATH;
|
||||
}
|
||||
} else {
|
||||
switch (Get-Stage) {
|
||||
$null {
|
||||
}
|
||||
Default {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-WindowsInstallation([Context] $context) {
|
||||
|
|
|
@ -2,6 +2,11 @@ using namespace Microsoft.Win32;
|
|||
using namespace System.Security.AccessControl;
|
||||
using namespace System.Security.Principal;
|
||||
|
||||
enum SetupStage {
|
||||
Initialize = "init"
|
||||
Install = "install"
|
||||
}
|
||||
|
||||
$null = New-Module {
|
||||
[string] $configRoot = "HKLM:\Software\PortValhalla";
|
||||
[string] $stageOption = "Stage";
|
||||
|
|
Loading…
Reference in a new issue