Nest installation functions in a module

This commit is contained in:
Manuel Thalmann 2024-08-01 19:02:12 +02:00
parent 9bcdd2fd9f
commit 06b314b1f5

View file

@ -11,19 +11,20 @@
. "$PSScriptRoot/Manage.ps1"; . "$PSScriptRoot/Manage.ps1";
. "$PSScriptRoot/User/Install.ps1"; . "$PSScriptRoot/User/Install.ps1";
<# $null = New-Module {
<#
.SYNOPSIS .SYNOPSIS
Finishes the installation of a running Windows machine. Finishes the installation of a running Windows machine.
#> #>
function Start-WindowsInstallation { function Start-WindowsInstallation {
Start-InstallationLoop; Start-InstallationLoop;
} }
<# <#
.SYNOPSIS .SYNOPSIS
Starts the installation loop. Starts the installation loop.
#> #>
function Start-InstallationLoop { function Start-InstallationLoop {
while (-not (Get-IsFinished)) { while (-not (Get-IsFinished)) {
if ($null -eq (Get-Stage)) { if ($null -eq (Get-Stage)) {
Set-Stage ([SetupStage]::Initialize); Set-Stage ([SetupStage]::Initialize);
@ -114,16 +115,16 @@ function Start-InstallationLoop {
} }
} }
} }
} }
function Invoke-WindowsInstallation([Context] $context) { function Invoke-WindowsInstallation([Context] $context) {
$Global:InformationPreference = "Continue"; $Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire"; $Global:ErrorActionPreference = "Inquire";
$context.UserNames ??= @("Manuel"); $context.UserNames ??= @("Manuel");
Start-OldWindowsInstallationScript $context; Start-OldWindowsInstallationScript $context;
} }
function Start-OldWindowsInstallationScript([Context] $context) { function Start-OldWindowsInstallationScript([Context] $context) {
. "$PSScriptRoot/Upgrade.ps1"; . "$PSScriptRoot/Upgrade.ps1";
$finished = $false; $finished = $false;
Remove-Item Env:\POSH_THEME -ErrorAction SilentlyContinue; Remove-Item Env:\POSH_THEME -ErrorAction SilentlyContinue;
@ -220,4 +221,5 @@ function Start-OldWindowsInstallationScript([Context] $context) {
} }
} }
} }
} }
};