diff --git a/scripts/Common/Scripts/Software.ps1 b/scripts/Common/Scripts/Software.ps1 index ac97d4ff0..f92cdeb0e 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 f7457cb78..394a77850 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 a58c55f5a..0337f9b78 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/PowerShell/Module.ps1 b/scripts/Common/Software/PowerShell/Module.ps1 index cc8104294..03f490675 100644 --- a/scripts/Common/Software/PowerShell/Module.ps1 +++ b/scripts/Common/Software/PowerShell/Module.ps1 @@ -30,7 +30,6 @@ $null = New-Module { }; installer = { param( - [scriptblock] $Installer, [hashtable] $Arguments ) @@ -46,7 +45,6 @@ $null = New-Module { } Remove-Item Env:\PENDING_MODULE_NAME; - & $Installer -Action ([InstallerAction]::Configure) @PSBoundParameters; }; configurator = { diff --git a/scripts/Common/Software/git/Manage.ps1 b/scripts/Common/Software/git/Manage.ps1 index f3c10a457..3bc76b779 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 fedba546d..beb6105b2 100644 --- a/scripts/Windows/Software/Firefox/Manage.ps1 +++ b/scripts/Windows/Software/Firefox/Manage.ps1 @@ -8,12 +8,7 @@ param( Start-SoftwareInstaller @PSBoundParameters ` -Installer { - param( - [scriptblock] $Installer - ) - 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 f189a7dce..e87fa1df0 100644 --- a/scripts/Windows/Software/MSEdgeRedirect/Manage.ps1 +++ b/scripts/Windows/Software/MSEdgeRedirect/Manage.ps1 @@ -7,12 +7,7 @@ param( Start-SoftwareInstaller @PSBoundParameters ` -Installer { - param( - [scriptblock] $Installer - ) - 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 b420edb29..6987f65d6 100644 --- a/scripts/Windows/Software/NVS/Manage.ps1 +++ b/scripts/Windows/Software/NVS/Manage.ps1 @@ -12,17 +12,12 @@ param( Start-SoftwareInstaller @PSBoundParameters ` -Installer { - param( - [scriptblock] $Installer - ) - $env:NVS_HOME = "$env:ProgramData\nvs"; git clone "https://github.com/jasongin/nvs.git" $env:NVS_HOME; & "$env:NVS_HOME\nvs.cmd" install; 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 baf44375e..569ffa3f4 100644 --- a/scripts/Windows/Software/Oh My Posh/Manage.ps1 +++ b/scripts/Windows/Software/Oh My Posh/Manage.ps1 @@ -8,12 +8,7 @@ param ( Start-SoftwareInstaller @PSBoundParameters ` -Installer { - param( - [scriptblock] $Installer - ) - 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 03b3a6177..ed4e33bc3 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 c7ff69450..d8b9075c5 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 127469814..dc11372ab 100644 --- a/scripts/Windows/Software/Thunderbird/Manage.ps1 +++ b/scripts/Windows/Software/Thunderbird/Manage.ps1 @@ -10,12 +10,7 @@ param( Start-SoftwareInstaller @PSBoundParameters ` -Installer { - param( - [scriptblock] $Installer - ) - 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 80d200643..2d977288e 100644 --- a/scripts/Windows/Software/WinSCP/Manage.ps1 +++ b/scripts/Windows/Software/WinSCP/Manage.ps1 @@ -11,12 +11,7 @@ param( Start-SoftwareInstaller @PSBoundParameters ` -Installer { - param( - [scriptblock] $Installer - ) - 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 c0b68d5de..80b8017e3 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 7a9dbbf53..768e60510 100644 --- a/scripts/Windows/Software/chocolatey/Manage.ps1 +++ b/scripts/Windows/Software/chocolatey/Manage.ps1 @@ -9,13 +9,6 @@ param( . "$PSScriptRoot/../../../Common/Software/PowerShell/Profile.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 92578fdc8..00eb5a6b7 100644 --- a/scripts/Windows/Software/git/Manage.ps1 +++ b/scripts/Windows/Software/git/Manage.ps1 @@ -42,10 +42,6 @@ $null = New-Module { Start-SoftwareInstaller @Parameters ` -Installer { - param( - [scriptblock] $Installer - ) - $params = "/WindowsTerminalProfile"; $defaultBranch = Get-GitOption "defaultBranch"; @@ -54,7 +50,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 dc99882e2..89f0c13ba 100644 --- a/scripts/Windows/Software/zoxide/Manage.ps1 +++ b/scripts/Windows/Software/zoxide/Manage.ps1 @@ -8,13 +8,8 @@ param( Start-SoftwareInstaller @PSBoundParameters ` -Installer { - param( - [scriptblock] $Installer - ) - Install-ChocoPackage zoxide; Install-WingetPackage junegunn.fzf; - & $Installer -Action ([InstallerAction]::Configure); } ` -Configurator { Add-PowerShellProfileStatement `