2024-08-07 18:30:12 +00:00
|
|
|
param (
|
|
|
|
$Action,
|
|
|
|
[hashtable] $Arguments
|
|
|
|
)
|
|
|
|
|
2024-08-07 19:05:32 +00:00
|
|
|
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
2024-08-07 19:34:40 +00:00
|
|
|
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
2024-08-07 19:05:32 +00:00
|
|
|
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
2024-08-07 18:30:12 +00:00
|
|
|
|
|
|
|
Start-SoftwareInstaller @PSBoundParameters `
|
|
|
|
-Configurator {
|
|
|
|
[string] $globalDir = $null;
|
|
|
|
$indicator = "# Profile Files";
|
|
|
|
|
2024-08-07 19:35:03 +00:00
|
|
|
if (-not $IsWindows) {
|
2024-08-07 18:30:12 +00:00
|
|
|
$globalDir = '"/etc/powershell/conf.d"';
|
|
|
|
} else {
|
|
|
|
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
|
|
|
|
}
|
|
|
|
|
2024-08-07 19:34:40 +00:00
|
|
|
if (-not ((Test-Path -PathType Leaf $PROFILE) -and ((Get-Content $PROFILE) -contains $indicator))) {
|
|
|
|
Add-PowerShellProfileStatement `
|
|
|
|
-DefaultUser `
|
|
|
|
-Script (@(
|
2024-08-07 19:35:03 +00:00
|
|
|
$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 { . $_; };
|
2024-08-07 18:30:12 +00:00
|
|
|
}
|
2024-08-07 19:35:03 +00:00
|
|
|
}
|
|
|
|
}).ToString()) -join "`n") `
|
|
|
|
-Append;
|
2024-08-07 18:30:12 +00:00
|
|
|
}
|
|
|
|
};
|