Implement install loop properly
This commit is contained in:
parent
afb2d1be65
commit
73c0648611
1 changed files with 14 additions and 11 deletions
|
@ -31,25 +31,28 @@ function Start-InstallationLoop {
|
||||||
while (-not (Get-IsFinished)) {
|
while (-not (Get-IsFinished)) {
|
||||||
switch (Get-Stage) {
|
switch (Get-Stage) {
|
||||||
$null {
|
$null {
|
||||||
Invoke-Hook "Start-Initialization" -Fallback {
|
if (-not ((Get-Command "choco") -and (Get-Command "refreshenv"))) {
|
||||||
if (-not ((Get-Command "choco") -and (Get-Command "refreshenv"))) {
|
Invoke-Hook "Install-Chocolatey" -Fallback {
|
||||||
# Install chocolatey
|
# Install chocolatey
|
||||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
||||||
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'));
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'));
|
||||||
Import-Module $env:ChocolateyInstall/helpers/chocolateyProfile.psm1;
|
Import-Module $env:ChocolateyInstall/helpers/chocolateyProfile.psm1;
|
||||||
refreshenv;
|
refreshenv;
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (-not (Test-ChocoSoftware "powershell-core")) {
|
if (-not (Test-ChocoSoftware "powershell-core")) {
|
||||||
|
Invoke-Hook "Install-PowerShellCore" -Fallback {
|
||||||
choco install -y powershell-core --install-arguments='"ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 REGISTER_MANIFEST=1 USER_MU=1 ENABLE_MU=1"';
|
choco install -y powershell-core --install-arguments='"ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 REGISTER_MANIFEST=1 USER_MU=1 ENABLE_MU=1"';
|
||||||
Restart-Intermediate;
|
};
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Test-Path $env:PWSH_PATH) {
|
Restart-Intermediate;
|
||||||
Remove-Item -Recurse $env:PWSH_PATH;
|
return;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
if (Test-Path $env:PWSH_PATH) {
|
||||||
|
Remove-Item -Recurse $env:PWSH_PATH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Default {}
|
Default {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue