diff --git a/scripts/Common/Scripts/Software.ps1 b/scripts/Common/Scripts/Software.ps1 index da88aa8a..c48983f4 100644 --- a/scripts/Common/Scripts/Software.ps1 +++ b/scripts/Common/Scripts/Software.ps1 @@ -241,17 +241,18 @@ $null = New-Module { Write-Host "Installing $Name…"; & $Installer @argumentList; } + + & $installHandler @argumentList -Action ([InstallerAction]::Configure); + + if (-not (Test-SetupUser)) { + & $installHandler @argumentList -Action ([InstallerAction]::ConfigureUser); + } # ToDo: Automatically configure after installation } elseif ($Action -eq ([InstallerAction]::Configure)) { if ($Configurator) { Write-Host "Configuring $Name…"; & $Configurator @argumentList; } - - if (-not (Test-SetupUser)) { - $argumentList.Add("action", [InstallerAction]::ConfigureUser); - & $installHandler @argumentList; - } } elseif ($Action -eq ([InstallerAction]::ConfigureUser)) { if ((-not $Arguments.ContainsKey($userArgument)) -or (-not $Arguments[$userArgument])) { $Arguments.Add($userArgument, ($env:UserName)); diff --git a/scripts/Common/Software/Oh My Posh/Manage.ps1 b/scripts/Common/Software/Oh My Posh/Manage.ps1 index f7457cb7..394a7785 100644 --- a/scripts/Common/Software/Oh My Posh/Manage.ps1 +++ b/scripts/Common/Software/Oh My Posh/Manage.ps1 @@ -8,13 +8,6 @@ param ( . "$PSScriptRoot/../../Types/InstallerAction.ps1"; Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - param( - [scriptblock] $Installer - ) - - & $Installer -Action ([InstallerAction]::Configure); - } ` -Configurator { Add-PowerShellProfileStatement ` -System ` diff --git a/scripts/Common/Software/PowerShell/Manage.ps1 b/scripts/Common/Software/PowerShell/Manage.ps1 index 7c56b4c7..a0b41395 100644 --- a/scripts/Common/Software/PowerShell/Manage.ps1 +++ b/scripts/Common/Software/PowerShell/Manage.ps1 @@ -8,13 +8,6 @@ param ( . "$PSScriptRoot/../../Types/InstallerAction.ps1"; Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - param( - [scriptblock] $Installer - ) - - & $Installer -Action ([InstallerAction]::Configure); - } ` -Configurator { [string] $globalDir = $null; $indicator = "# Profile Files"; diff --git a/scripts/Common/Software/git/Manage.ps1 b/scripts/Common/Software/git/Manage.ps1 index f3c10a45..3bc76b77 100644 --- a/scripts/Common/Software/git/Manage.ps1 +++ b/scripts/Common/Software/git/Manage.ps1 @@ -7,12 +7,5 @@ param ( . "$PSScriptRoot/../../Types/InstallerAction.ps1"; Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - param( - [scriptblock] $Installer - ) - - & $Installer -Action ([InstallerAction]::Configure); - } ` -Configurator { }; diff --git a/scripts/Windows/Software/Firefox/Manage.ps1 b/scripts/Windows/Software/Firefox/Manage.ps1 index 0c9fb74e..1cb9ec43 100644 --- a/scripts/Windows/Software/Firefox/Manage.ps1 +++ b/scripts/Windows/Software/Firefox/Manage.ps1 @@ -13,7 +13,6 @@ Start-SoftwareInstaller @PSBoundParameters ` ) Install-ChocoPackage firefox; - & $Installer -Action ([InstallerAction]::Configure) } ` -Configurator { Write-Host "Making Firefox the default browser…"; diff --git a/scripts/Windows/Software/MSEdgeRedirect/Manage.ps1 b/scripts/Windows/Software/MSEdgeRedirect/Manage.ps1 index f189a7dc..6802471c 100644 --- a/scripts/Windows/Software/MSEdgeRedirect/Manage.ps1 +++ b/scripts/Windows/Software/MSEdgeRedirect/Manage.ps1 @@ -12,7 +12,6 @@ Start-SoftwareInstaller @PSBoundParameters ` ) Install-ChocoPackage MSEdgeRedirect; - & $Installer -Action ([InstallerAction]::Configure); } ` -Configurator { $configPath = "HKLM:\SOFTWARE\Robert Maehl Software\MSEdgeRedirect"; diff --git a/scripts/Windows/Software/NVS/Manage.ps1 b/scripts/Windows/Software/NVS/Manage.ps1 index b420edb2..96351a0c 100644 --- a/scripts/Windows/Software/NVS/Manage.ps1 +++ b/scripts/Windows/Software/NVS/Manage.ps1 @@ -22,7 +22,6 @@ Start-SoftwareInstaller @PSBoundParameters ` refreshenv; Set-UserPermissions $env:NVS_HOME; - & $Installer -Action ([InstallerAction]::Configure); } ` -Configurator { nvs add latest; diff --git a/scripts/Windows/Software/Oh My Posh/Manage.ps1 b/scripts/Windows/Software/Oh My Posh/Manage.ps1 index baf44375..19a58f49 100644 --- a/scripts/Windows/Software/Oh My Posh/Manage.ps1 +++ b/scripts/Windows/Software/Oh My Posh/Manage.ps1 @@ -13,7 +13,6 @@ Start-SoftwareInstaller @PSBoundParameters ` ) Install-WingetPackage JanDeDobbeleer.OhMyPosh -ArgumentList "--scope","machine"; - & $Installer -Action ([InstallerAction]::Configure); } ` -Configurator { . "$PSScriptRoot/../../../Common/Software/Oh My Posh/Manage.ps1" ` diff --git a/scripts/Windows/Software/OpenSSH/Manage.ps1 b/scripts/Windows/Software/OpenSSH/Manage.ps1 index 03b3a617..ed4e33bc 100644 --- a/scripts/Windows/Software/OpenSSH/Manage.ps1 +++ b/scripts/Windows/Software/OpenSSH/Manage.ps1 @@ -8,13 +8,6 @@ param( . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - param( - [scriptblock] $Installer - ) - - & $Installer -Action ([InstallerAction]::Configure) - } ` -Configurator { Set-Service ssh-agent -StartupType AutomaticDelayedStart; }; diff --git a/scripts/Windows/Software/PowerShell/Manage.ps1 b/scripts/Windows/Software/PowerShell/Manage.ps1 index c7ff6945..d8b9075c 100644 --- a/scripts/Windows/Software/PowerShell/Manage.ps1 +++ b/scripts/Windows/Software/PowerShell/Manage.ps1 @@ -7,13 +7,6 @@ param ( . "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1"; Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - param( - [scriptblock] $Installer - ) - - & $Installer -Action ([InstallerAction]::Configure); - } ` -Configurator { . "$PSScriptRoot/../../../Common/Software/PowerShell/Manage.ps1" ` -Action ([InstallerAction]::Configure); diff --git a/scripts/Windows/Software/Thunderbird/Manage.ps1 b/scripts/Windows/Software/Thunderbird/Manage.ps1 index 12746981..57601689 100644 --- a/scripts/Windows/Software/Thunderbird/Manage.ps1 +++ b/scripts/Windows/Software/Thunderbird/Manage.ps1 @@ -15,7 +15,6 @@ Start-SoftwareInstaller @PSBoundParameters ` ) Install-ChocoPackage thunderbird -ArgumentList "--params",'"/NoTaskbarShortcut /NoDesktopShortcut"' - & $Installer -Action ([InstallerAction]::Configure) } ` -Configurator { Write-Host "Making Thunderbird the default mail program…"; diff --git a/scripts/Windows/Software/WinSCP/Manage.ps1 b/scripts/Windows/Software/WinSCP/Manage.ps1 index 80d20064..589b3037 100644 --- a/scripts/Windows/Software/WinSCP/Manage.ps1 +++ b/scripts/Windows/Software/WinSCP/Manage.ps1 @@ -16,7 +16,6 @@ Start-SoftwareInstaller @PSBoundParameters ` ) Install-ChocoPackage winscp; - & $Installer -Action ([InstallerAction]::Configure) } ` -Configurator { Remove-DesktopIcon "WinSCP*"; diff --git a/scripts/Windows/Software/Windows/Manage.ps1 b/scripts/Windows/Software/Windows/Manage.ps1 index dcf20309..39741ca9 100644 --- a/scripts/Windows/Software/Windows/Manage.ps1 +++ b/scripts/Windows/Software/Windows/Manage.ps1 @@ -12,13 +12,6 @@ param( . "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1"; Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - param( - [scriptblock] $Installer - ) - - & $Installer -Action ([InstallerAction]::Configure) - } ` -Configurator { $dir = New-TemporaryDirectory; Push-Location $dir; diff --git a/scripts/Windows/Software/chocolatey/Manage.ps1 b/scripts/Windows/Software/chocolatey/Manage.ps1 index 1ca9490a..58b118be 100644 --- a/scripts/Windows/Software/chocolatey/Manage.ps1 +++ b/scripts/Windows/Software/chocolatey/Manage.ps1 @@ -8,13 +8,6 @@ param( . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; Start-SoftwareInstaller @PSBoundParameters ` - -Installer { - param( - [scriptblock] $Installer - ) - - & $Installer -Action ([InstallerAction]::Configure) - } ` -Configurator { [string] $backup = $null; $nativeProfile = powershell -c '$PROFILE'; diff --git a/scripts/Windows/Software/git/Manage.ps1 b/scripts/Windows/Software/git/Manage.ps1 index f7b76d3e..8eb32247 100644 --- a/scripts/Windows/Software/git/Manage.ps1 +++ b/scripts/Windows/Software/git/Manage.ps1 @@ -54,7 +54,6 @@ $null = New-Module { } Install-ChocoPackage git -ArgumentList "--params",$params; - & $Installer -Action ([InstallerAction]::Configure); } ` -Configurator { & "$PSScriptRoot/../../../Common/Software/git/Manage.ps1" @Parameters; diff --git a/scripts/Windows/Software/zoxide/Manage.ps1 b/scripts/Windows/Software/zoxide/Manage.ps1 index b2001e7d..3ce6998f 100644 --- a/scripts/Windows/Software/zoxide/Manage.ps1 +++ b/scripts/Windows/Software/zoxide/Manage.ps1 @@ -14,7 +14,6 @@ Start-SoftwareInstaller @PSBoundParameters ` Install-ChocoPackage zoxide; Install-WingetPackage junegunn.fzf; - & $Installer -Action ([InstallerAction]::Configure); } ` -Configurator { Add-PowerShellProfileStatement `