diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 6f8e53a8..934534b9 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -12,6 +12,7 @@ $null = New-Module { . "$PSScriptRoot/../Scripts/PowerManagement.ps1"; . "$PSScriptRoot/../Scripts/SoftwareManagement.ps1"; . "$PSScriptRoot/../Scripts/Update.ps1"; + . "$PSScriptRoot/../Types/InstallerAction.ps1"; <# .SYNOPSIS @@ -92,6 +93,33 @@ $null = New-Module { Restart-Intermediate; return; } + + <# + .SYNOPSIS + Deploys an action for each software. + + .PARAMETER Action + The action to execute by default. + #> + function Deploy-SoftwareAction { + param( + [InstallerAction] $Action + ) + + $arguments = [hashtable]@{ }; + + if ($Action) { + $arguments.Add("action", $Action); + } + + # Windows Config + . "$PSScriptRoot/../Software/Windows/Manage.ps1" @arguments; + + if (Test-Collection "essential") { + # Essentials + . "$PSScriptRoot/../Software/OpenSSH/Manage.ps1" @arguments; + } + } switch (Get-Stage) { ([SetupStage]::Configure) { @@ -114,15 +142,7 @@ $null = New-Module { } ([SetupStage]::Install) { Write-Host "Entering install phase"; - - # Windows Config - . "$PSScriptRoot/../Software/Windows/Manage.ps1"; - - if (Test-Collection "essential") { - # Essentials - . "$PSScriptRoot/../Software/OpenSSH/Manage.ps1"; - } - + Deploy-SoftwareAction; Set-IsFinished $true; } }