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 {
|
function Start-InstallationLoop {
|
||||||
while (-not (Get-IsFinished)) {
|
while (-not (Get-IsFinished)) {
|
||||||
if ($null -eq (Get-Stage)) {
|
switch (Get-Stage) {
|
||||||
|
($null) {
|
||||||
Set-Stage ([SetupStage]::Initialize);
|
Set-Stage ([SetupStage]::Initialize);
|
||||||
} elseif ((Get-Stage) -eq ([SetupStage]::Initialize)) {
|
break;
|
||||||
|
}
|
||||||
|
([SetupStage]::Initialize) {
|
||||||
if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) {
|
if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) {
|
||||||
Invoke-Hook "Install-Chocolatey" -Fallback {
|
Invoke-Hook "Install-Chocolatey" -Fallback {
|
||||||
# Install chocolatey
|
# Install chocolatey
|
||||||
|
@ -117,7 +120,9 @@ $null = New-Module {
|
||||||
};
|
};
|
||||||
|
|
||||||
Set-Stage ([SetupStage]::Configure);
|
Set-Stage ([SetupStage]::Configure);
|
||||||
} else {
|
break;
|
||||||
|
}
|
||||||
|
default {
|
||||||
$null = Import-Module PSWindowsUpdate;
|
$null = Import-Module PSWindowsUpdate;
|
||||||
|
|
||||||
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
||||||
|
@ -481,6 +486,7 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Invoke-WindowsInstallation([Context] $context) {
|
function Invoke-WindowsInstallation([Context] $context) {
|
||||||
$Global:InformationPreference = "Continue";
|
$Global:InformationPreference = "Continue";
|
||||||
|
|
Loading…
Reference in a new issue