Nest installation functions in a module

This commit is contained in:
Manuel Thalmann 2024-08-01 19:02:12 +02:00
parent 5bb1a19a1f
commit 9b6cdd24e5

View file

@ -12,19 +12,20 @@
. "$PSScriptRoot/../Scripts/Update.ps1"; . "$PSScriptRoot/../Scripts/Update.ps1";
. "$PSScriptRoot/../Software/Firefox/Install.ps1"; . "$PSScriptRoot/../Software/Firefox/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);
@ -115,16 +116,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;
@ -221,4 +222,5 @@ function Start-OldWindowsInstallationScript([Context] $context) {
} }
} }
} }
} }
};