Execute the entire installer using live scripts
This commit is contained in:
parent
596bca0b4e
commit
6b35ce6f39
1 changed files with 66 additions and 61 deletions
|
@ -49,20 +49,6 @@ $null = New-Module {
|
|||
break;
|
||||
}
|
||||
([SetupStage]::Initialize) {
|
||||
if ($env:DEBUG) {
|
||||
& {
|
||||
$sys32 = "$env:WINDIR/System32";
|
||||
$osk = "$sys32/osk.exe";
|
||||
$cmd = "$sys32/cmd.exe";
|
||||
|
||||
if ((Get-FileHash $osk) -ne (Get-FileHash $cmd)) {
|
||||
Rename-Item $osk "${osk}_";
|
||||
Copy-Item $cmd $osk;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) {
|
||||
Invoke-Hook "Install-Chocolatey" -Fallback {
|
||||
# Install chocolatey
|
||||
|
@ -75,25 +61,25 @@ $null = New-Module {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-Command "gsudo")) {
|
||||
Install-ChocoPackage gsudo;
|
||||
refreshenv;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-Command "git")) {
|
||||
Install-ChocoPackage git;
|
||||
refreshenv;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-ChocoPackage "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"';
|
||||
};
|
||||
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($env:PWSH_PATH -and (Test-Path $env:PWSH_PATH)) {
|
||||
attrib "-R" "$env:PWSH_PATH\*" /S /D;
|
||||
Remove-Item -Recurse -Force $env:PWSH_PATH;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($env:DEBUG) {
|
||||
if (
|
||||
(Get-Item $env:INSTALLER_SCRIPT).IsReadOnly -and
|
||||
(Test-Qemu) -and
|
||||
($Host.UI.PromptForChoice(
|
||||
"Confirm",
|
||||
|
@ -119,16 +105,35 @@ $null = New-Module {
|
|||
Set-Item "Env:\$name" $path;
|
||||
Write-Host "The new value of ``$name`` is ``$path``";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($env:PWSH_PATH -and (Test-Path $env:PWSH_PATH)) {
|
||||
attrib "-R" "$env:PWSH_PATH\*" /S /D;
|
||||
Remove-Item -Recurse -Force $env:PWSH_PATH;
|
||||
if ($env:DEBUG) {
|
||||
& {
|
||||
$sys32 = "$env:WINDIR/System32";
|
||||
$osk = "$sys32/osk.exe";
|
||||
$cmd = "$sys32/cmd.exe";
|
||||
|
||||
if ((Get-FileHash $osk) -ne (Get-FileHash $cmd)) {
|
||||
Rename-Item $osk "${osk}_";
|
||||
Copy-Item $cmd $osk;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (-not (Test-Command "gsudo")) {
|
||||
Install-ChocoPackage gsudo;
|
||||
refreshenv;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-Command "git")) {
|
||||
Install-ChocoPackage git;
|
||||
refreshenv;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -596,14 +601,14 @@ $null = New-Module {
|
|||
foreach ($group in Get-UserConfig -UserName $name "groups") {
|
||||
Add-LocalGroupMember -Member $name -Name "$group";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $msAccount) {
|
||||
net user $name /logonpasswordchg:yes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Set-IsFinished $true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue