param ( $Action, [hashtable] $Arguments ) . "$PSScriptRoot/../../Scripts/Software.ps1"; . "$PSScriptRoot/../../Scripts/Scripting.ps1"; . "$PSScriptRoot/../../Types/InstallerAction.ps1"; Start-SoftwareInstaller @PSBoundParameters ` -Installer { param( [scriptblock] $Installer ) & $Installer -Action ([InstallerAction]::Configure); } ` -Configurator { param( [hashtable] $Arguments ) [string] $globalDir = $null; $indicator = "# Profile Files"; if ($Arguments.Linux) { $globalDir = '"/etc/powershell/conf.d"'; } else { $globalDir = '"$env:ProgramData/PowerShell/conf.d"'; } [System.Collections.ArrayList] $files = @($PROFILE); if (Test-Command powershell) { $null = $files.Add((powershell -c '$PROFILE')); } foreach ($file in $files) { if (-not ((Test-Path -PathType Leaf $file) -and ((Get-Content $file) -contains $indicator))) { Write-PSScript -FileName $file -Script (@( $indicator, "`$globalDir = $globalDir", ({ $profileRoot = Split-Path -Parent $PROFILE; $profilePaths = @( "$profileRoot/conf.d/*.ps1", "$globalDir/*.ps1" ) foreach ($profilePath in $profilePaths) { if (Test-Path $profilePath) { Get-Item $profilePath | ForEach-Object { . $_; }; } } }).ToString()) -join "`n") ` -Append; } } };