Implement root install loop using a switch
This commit is contained in:
parent
b8086193bd
commit
eb6ad4780e
1 changed files with 401 additions and 395 deletions
|
@ -36,9 +36,12 @@ $null = New-Module {
|
|||
#>
|
||||
function Start-InstallationLoop {
|
||||
while (-not (Get-IsFinished)) {
|
||||
if ($null -eq (Get-Stage)) {
|
||||
switch (Get-Stage) {
|
||||
($null) {
|
||||
Set-Stage ([SetupStage]::Initialize);
|
||||
} elseif ((Get-Stage) -eq ([SetupStage]::Initialize)) {
|
||||
break;
|
||||
}
|
||||
([SetupStage]::Initialize) {
|
||||
if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) {
|
||||
Invoke-Hook "Install-Chocolatey" -Fallback {
|
||||
# Install chocolatey
|
||||
|
@ -117,7 +120,9 @@ $null = New-Module {
|
|||
};
|
||||
|
||||
Set-Stage ([SetupStage]::Configure);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
default {
|
||||
$null = Import-Module PSWindowsUpdate;
|
||||
|
||||
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
||||
|
@ -481,6 +486,7 @@ $null = New-Module {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-WindowsInstallation([Context] $context) {
|
||||
$Global:InformationPreference = "Continue";
|
||||
|
|
Loading…
Reference in a new issue